]> git.ipfire.org Git - thirdparty/git.git/commitdiff
bundle-uri: suppress stderr from remote-https
authorDerrick Stolee <derrickstolee@github.com>
Wed, 12 Oct 2022 12:52:39 +0000 (12:52 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 12 Oct 2022 16:13:25 +0000 (09:13 -0700)
When downloading bundles from a git-remote-https subprocess, the bundle
URI logic wants to be opportunistic and download as much as possible and
work with what did succeed. This is particularly important in the "any"
mode, where any single bundle success will work.

If the URI is not available, the git-remote-https process will die()
with a "fatal:" error message, even though that error is not actually
fatal to the super process. Since stderr is passed through, it looks
like a fatal error to the user.

Suppress stderr to avoid these errors from bubbling to the surface. The
bundle URI API adds its own warning() messages on these failures.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
bundle-uri.c
t/t5558-clone-bundle-uri.sh

index d872acf5ab054eeee835e0b455c0c21f1b6c351c..79a914f961b134cccc6029aa403d7a626841c81b 100644 (file)
@@ -230,6 +230,7 @@ static int download_https_uri_to_file(const char *file, const char *uri)
        int found_get = 0;
 
        strvec_pushl(&cp.args, "git-remote-https", uri, NULL);
+       cp.err = -1;
        cp.in = -1;
        cp.out = -1;
 
index 9b1590783866ab8493909d1daaa9837e912ddd02..9155f31fa2cb58db4e09814f451ee87b63c5dfdc 100755 (executable)
@@ -147,6 +147,8 @@ test_expect_success 'clone bundle list (file, all mode, some failures)' '
        git clone --bundle-uri="file://$(pwd)/bundle-list" \
                clone-from clone-all-some 2>err &&
        ! grep "Repository lacks these prerequisite commits" err &&
+       ! grep "fatal" err &&
+       grep "warning: failed to download bundle from URI" err &&
 
        git -C clone-from for-each-ref --format="%(objectname)" >oids &&
        git -C clone-all-some cat-file --batch-check <oids &&
@@ -178,6 +180,8 @@ test_expect_success 'clone bundle list (file, all mode, all failures)' '
        git clone --bundle-uri="file://$(pwd)/bundle-list" \
                clone-from clone-all-fail 2>err &&
        ! grep "Repository lacks these prerequisite commits" err &&
+       ! grep "fatal" err &&
+       grep "warning: failed to download bundle from URI" err &&
 
        git -C clone-from for-each-ref --format="%(objectname)" >oids &&
        git -C clone-all-fail cat-file --batch-check <oids &&
@@ -234,7 +238,11 @@ test_expect_success 'clone bundle list (file, any mode, all failures)' '
                uri = $HTTPD_URL/bundle-5.bundle
        EOF
 
-       git clone --bundle-uri="file://$(pwd)/bundle-list" clone-from clone-any-fail &&
+       git clone --bundle-uri="file://$(pwd)/bundle-list" \
+               clone-from clone-any-fail 2>err &&
+       ! grep "fatal" err &&
+       grep "warning: failed to download bundle from URI" err &&
+
        git -C clone-from for-each-ref --format="%(objectname)" >oids &&
        git -C clone-any-fail cat-file --batch-check <oids &&
 
@@ -323,7 +331,11 @@ test_expect_success 'clone bundle list (HTTP, any mode)' '
                uri = $HTTPD_URL/bundle-5.bundle
        EOF
 
-       git clone --bundle-uri="$HTTPD_URL/bundle-list" clone-from clone-any-http &&
+       git clone --bundle-uri="$HTTPD_URL/bundle-list" \
+               clone-from clone-any-http 2>err &&
+       ! grep "fatal" err &&
+       grep "warning: failed to download bundle from URI" err &&
+
        git -C clone-from for-each-ref --format="%(objectname)" >oids &&
        git -C clone-any-http cat-file --batch-check <oids &&