]> git.ipfire.org Git - thirdparty/git.git/commitdiff
tests: define GIT_TEST_SIDEBAND_ALL
authorJonathan Tan <jonathantanmy@google.com>
Wed, 16 Jan 2019 19:28:15 +0000 (11:28 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 17 Jan 2019 19:25:07 +0000 (11:25 -0800)
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 <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
fetch-pack.c
t/README
t/lib-httpd/apache.conf
t/t5537-fetch-shallow.sh
t/t5701-git-serve.sh
t/t5702-protocol-v2.sh
upload-pack.c

index 86e9e18901a940d03ac9b337fe71c4a7fa628fe5..e98294d918d22545183c0658b27a52ed0a355113 100644 (file)
@@ -1327,7 +1327,8 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args,
        packet_reader_init(&reader, fd[0], NULL, 0,
                           PACKET_READ_CHOMP_NEWLINE |
                           PACKET_READ_DIE_ON_ERR_PACKET);
-       if (server_supports_feature("fetch", "sideband-all", 0)) {
+       if (git_env_bool("GIT_TEST_SIDEBAND_ALL", 1) &&
+           server_supports_feature("fetch", "sideband-all", 0)) {
                reader.use_sideband = 1;
                reader.me = "fetch-pack";
        }
index 28711cc508f9e5dfb2f2ef238be14926d56f9a12..b275c883b89856d3c47101a4b41296d4670f66a2 100644 (file)
--- a/t/README
+++ b/t/README
@@ -358,6 +358,11 @@ GIT_TEST_MULTI_PACK_INDEX=<boolean>, when true, forces the multi-pack-
 index to be written after every 'git repack' command, and overrides the
 'core.multiPackIndex' setting to true.
 
+GIT_TEST_SIDEBAND_ALL=<boolean>, when true, overrides the
+'uploadpack.allowSidebandAll' setting to true, and when false, forces
+fetch-pack to not request sideband-all (even if the server advertises
+sideband-all).
+
 Naming Tests
 ------------
 
index 581c010d8fc4c1184ba17b63b940aaac30d0b0f4..9a6d3682475b38c4a67fb092dff550e459b9d6d3 100644 (file)
@@ -78,6 +78,7 @@ PassEnv GNUPGHOME
 PassEnv ASAN_OPTIONS
 PassEnv GIT_TRACE
 PassEnv GIT_CONFIG_NOSYSTEM
+PassEnv GIT_TEST_SIDEBAND_ALL
 
 SetEnvIf Git-Protocol ".*" GIT_PROTOCOL=$0
 
index 6faf17e17a133f31245f89fd0fe9bad1687ac5fa..6caf628efaaa400473ddfb46fdef0b847b4edd39 100755 (executable)
@@ -243,7 +243,8 @@ test_expect_success 'shallow fetches check connectivity before writing shallow f
               "$(git -C "$REPO" rev-parse HEAD)" \
               "$(git -C "$REPO" rev-parse HEAD^)" \
               >"$HTTPD_ROOT_PATH/one-time-sed" &&
-       test_must_fail git -C client fetch --depth=1 "$HTTPD_URL/one_time_sed/repo" \
+       test_must_fail env GIT_TEST_SIDEBAND_ALL=0 git -C client \
+               fetch --depth=1 "$HTTPD_URL/one_time_sed/repo" \
                master:a_branch &&
 
        # Ensure that the one-time-sed script was used.
index ae79c6bbc0d66e9a7a184b2d1726a316a0affbbe..fe45bf828d09cd9d95a66742ef938837d35141a3 100755 (executable)
@@ -14,7 +14,7 @@ test_expect_success 'test capability advertisement' '
        0000
        EOF
 
-       git serve --advertise-capabilities >out &&
+       GIT_TEST_SIDEBAND_ALL=0 git serve --advertise-capabilities >out &&
        test-tool pkt-line unpack <out >actual &&
        test_cmp expect actual
 '
index 0f2b09ebb8d6625b527ccc771c4725d2a314d4ee..b491c62e3efbf818f8b0cf4aece0122e51c03561 100755 (executable)
@@ -583,8 +583,8 @@ test_expect_success 'when server does not send "ready", expect FLUSH' '
        test_must_fail env GIT_TRACE_PACKET="$(pwd)/log" git -C http_child \
                -c protocol.version=2 \
                fetch "$HTTPD_URL/one_time_sed/http_parent" 2> err &&
-       grep "fetch< acknowledgments" log &&
-       ! grep "fetch< ready" log &&
+       grep "fetch< .*acknowledgments" log &&
+       ! grep "fetch< .*ready" log &&
        test_i18ngrep "expected no other sections to be sent after no .ready." err
 '
 
index 765b7695d2b0da442854ff80e0a4fcd173016830..0c1feccaabac10fcb26828e0265f5aa053952253 100644 (file)
@@ -1288,7 +1288,9 @@ static void process_args(struct packet_reader *request,
                        continue;
                }
 
-               if (allow_sideband_all && !strcmp(arg, "sideband-all")) {
+               if ((git_env_bool("GIT_TEST_SIDEBAND_ALL", 0) ||
+                    allow_sideband_all) &&
+                   !strcmp(arg, "sideband-all")) {
                        data->writer.use_sideband = 1;
                        continue;
                }
@@ -1521,10 +1523,11 @@ int upload_pack_advertise(struct repository *r,
                    allow_ref_in_want)
                        strbuf_addstr(value, " ref-in-want");
 
-               if (!repo_config_get_bool(the_repository,
-                                        "uploadpack.allowsidebandall",
-                                        &allow_sideband_all_value) &&
-                   allow_sideband_all_value)
+               if (git_env_bool("GIT_TEST_SIDEBAND_ALL", 0) ||
+                   (!repo_config_get_bool(the_repository,
+                                          "uploadpack.allowsidebandall",
+                                          &allow_sideband_all_value) &&
+                    allow_sideband_all_value))
                        strbuf_addstr(value, " sideband-all");
        }