Skip to content

Commit 07c3c2a

Browse files
jonathantanmygitster
authored andcommitted
tests: define GIT_TEST_SIDEBAND_ALL
Define a GIT_TEST_SIDEBAND_ALL environment variable meant to be used from tests. When set to true, this overrides uploadpack.allowsidebandall to true, allowing the entire test suite to be run as if this configuration is in place for all repositories. As of this patch, all tests pass whether GIT_TEST_SIDEBAND_ALL is unset or set to 1. Signed-off-by: Jonathan Tan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0bbc0bc commit 07c3c2a

File tree

7 files changed

+21
-10
lines changed

7 files changed

+21
-10
lines changed

fetch-pack.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1327,7 +1327,8 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args,
13271327
packet_reader_init(&reader, fd[0], NULL, 0,
13281328
PACKET_READ_CHOMP_NEWLINE |
13291329
PACKET_READ_DIE_ON_ERR_PACKET);
1330-
if (server_supports_feature("fetch", "sideband-all", 0)) {
1330+
if (git_env_bool("GIT_TEST_SIDEBAND_ALL", 1) &&
1331+
server_supports_feature("fetch", "sideband-all", 0)) {
13311332
reader.use_sideband = 1;
13321333
reader.me = "fetch-pack";
13331334
}

t/README

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,11 @@ GIT_TEST_MULTI_PACK_INDEX=<boolean>, when true, forces the multi-pack-
358358
index to be written after every 'git repack' command, and overrides the
359359
'core.multiPackIndex' setting to true.
360360

361+
GIT_TEST_SIDEBAND_ALL=<boolean>, when true, overrides the
362+
'uploadpack.allowSidebandAll' setting to true, and when false, forces
363+
fetch-pack to not request sideband-all (even if the server advertises
364+
sideband-all).
365+
361366
Naming Tests
362367
------------
363368

t/lib-httpd/apache.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ PassEnv GNUPGHOME
7878
PassEnv ASAN_OPTIONS
7979
PassEnv GIT_TRACE
8080
PassEnv GIT_CONFIG_NOSYSTEM
81+
PassEnv GIT_TEST_SIDEBAND_ALL
8182

8283
SetEnvIf Git-Protocol ".*" GIT_PROTOCOL=$0
8384

t/t5537-fetch-shallow.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,8 @@ test_expect_success 'shallow fetches check connectivity before writing shallow f
243243
"$(git -C "$REPO" rev-parse HEAD)" \
244244
"$(git -C "$REPO" rev-parse HEAD^)" \
245245
>"$HTTPD_ROOT_PATH/one-time-sed" &&
246-
test_must_fail git -C client fetch --depth=1 "$HTTPD_URL/one_time_sed/repo" \
246+
test_must_fail env GIT_TEST_SIDEBAND_ALL=0 git -C client \
247+
fetch --depth=1 "$HTTPD_URL/one_time_sed/repo" \
247248
master:a_branch &&
248249
249250
# Ensure that the one-time-sed script was used.

t/t5701-git-serve.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ test_expect_success 'test capability advertisement' '
1414
0000
1515
EOF
1616
17-
git serve --advertise-capabilities >out &&
17+
GIT_TEST_SIDEBAND_ALL=0 git serve --advertise-capabilities >out &&
1818
test-tool pkt-line unpack <out >actual &&
1919
test_cmp expect actual
2020
'

t/t5702-protocol-v2.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,8 +583,8 @@ test_expect_success 'when server does not send "ready", expect FLUSH' '
583583
test_must_fail env GIT_TRACE_PACKET="$(pwd)/log" git -C http_child \
584584
-c protocol.version=2 \
585585
fetch "$HTTPD_URL/one_time_sed/http_parent" 2> err &&
586-
grep "fetch< acknowledgments" log &&
587-
! grep "fetch< ready" log &&
586+
grep "fetch< .*acknowledgments" log &&
587+
! grep "fetch< .*ready" log &&
588588
test_i18ngrep "expected no other sections to be sent after no .ready." err
589589
'
590590

upload-pack.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,9 @@ static void process_args(struct packet_reader *request,
12881288
continue;
12891289
}
12901290

1291-
if (allow_sideband_all && !strcmp(arg, "sideband-all")) {
1291+
if ((git_env_bool("GIT_TEST_SIDEBAND_ALL", 0) ||
1292+
allow_sideband_all) &&
1293+
!strcmp(arg, "sideband-all")) {
12921294
data->writer.use_sideband = 1;
12931295
continue;
12941296
}
@@ -1521,10 +1523,11 @@ int upload_pack_advertise(struct repository *r,
15211523
allow_ref_in_want)
15221524
strbuf_addstr(value, " ref-in-want");
15231525

1524-
if (!repo_config_get_bool(the_repository,
1525-
"uploadpack.allowsidebandall",
1526-
&allow_sideband_all_value) &&
1527-
allow_sideband_all_value)
1526+
if (git_env_bool("GIT_TEST_SIDEBAND_ALL", 0) ||
1527+
(!repo_config_get_bool(the_repository,
1528+
"uploadpack.allowsidebandall",
1529+
&allow_sideband_all_value) &&
1530+
allow_sideband_all_value))
15281531
strbuf_addstr(value, " sideband-all");
15291532
}
15301533

0 commit comments

Comments
 (0)