bundle-uri: suppress stderr from remote-https

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>

Derrick Stolee committed Oct 12, 2022 at 12:52 UTC 8628a842bddda7723ad7548b7f6d141123a164a0
2 files changed +15 -2
bundle-uri.c
+1
@@ -230,6 +230,7 @@ static int download_https_uri_to_file(const char *file, const char *uri)
230 int found_get = 0;
231
232 strvec_pushl(&cp.args, "git-remote-https", uri, NULL);
233 + cp.err = -1;
234 cp.in = -1;
235 cp.out = -1;
236
t/t5558-clone-bundle-uri.sh
+14 -2
@@ -147,6 +147,8 @@ test_expect_success 'clone bundle list (file, all mode, some failures)' '
147 git clone --bundle-uri="file://$(pwd)/bundle-list" \
148 clone-from clone-all-some 2>err &&
149 ! grep "Repository lacks these prerequisite commits" err &&
150 + ! grep "fatal" err &&
151 + grep "warning: failed to download bundle from URI" err &&
152
153 git -C clone-from for-each-ref --format="%(objectname)" >oids &&
154 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)' '
180 git clone --bundle-uri="file://$(pwd)/bundle-list" \
181 clone-from clone-all-fail 2>err &&
182 ! grep "Repository lacks these prerequisite commits" err &&
183 + ! grep "fatal" err &&
184 + grep "warning: failed to download bundle from URI" err &&
185
186 git -C clone-from for-each-ref --format="%(objectname)" >oids &&
187 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)' '
238 uri = $HTTPD_URL/bundle-5.bundle
239 EOF
240
237 - git clone --bundle-uri="file://$(pwd)/bundle-list" clone-from clone-any-fail &&
241 + git clone --bundle-uri="file://$(pwd)/bundle-list" \
242 + clone-from clone-any-fail 2>err &&
243 + ! grep "fatal" err &&
244 + grep "warning: failed to download bundle from URI" err &&
245 +
246 git -C clone-from for-each-ref --format="%(objectname)" >oids &&
247 git -C clone-any-fail cat-file --batch-check <oids &&
248
@@ -323,7 +331,11 @@ test_expect_success 'clone bundle list (HTTP, any mode)' '
331 uri = $HTTPD_URL/bundle-5.bundle
332 EOF
333
326 - git clone --bundle-uri="$HTTPD_URL/bundle-list" clone-from clone-any-http &&
334 + git clone --bundle-uri="$HTTPD_URL/bundle-list" \
335 + clone-from clone-any-http 2>err &&
336 + ! grep "fatal" err &&
337 + grep "warning: failed to download bundle from URI" err &&
338 +
339 git -C clone-from for-each-ref --format="%(objectname)" >oids &&
340 git -C clone-any-http cat-file --batch-check <oids &&
341