Skip to content

Commit 8628a84

Browse files
derrickstoleegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 70334fc commit 8628a84

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

bundle-uri.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ static int download_https_uri_to_file(const char *file, const char *uri)
230230
int found_get = 0;
231231

232232
strvec_pushl(&cp.args, "git-remote-https", uri, NULL);
233+
cp.err = -1;
233234
cp.in = -1;
234235
cp.out = -1;
235236

t/t5558-clone-bundle-uri.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ test_expect_success 'clone bundle list (file, all mode, some failures)' '
147147
git clone --bundle-uri="file://$(pwd)/bundle-list" \
148148
clone-from clone-all-some 2>err &&
149149
! grep "Repository lacks these prerequisite commits" err &&
150+
! grep "fatal" err &&
151+
grep "warning: failed to download bundle from URI" err &&
150152
151153
git -C clone-from for-each-ref --format="%(objectname)" >oids &&
152154
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)' '
178180
git clone --bundle-uri="file://$(pwd)/bundle-list" \
179181
clone-from clone-all-fail 2>err &&
180182
! grep "Repository lacks these prerequisite commits" err &&
183+
! grep "fatal" err &&
184+
grep "warning: failed to download bundle from URI" err &&
181185
182186
git -C clone-from for-each-ref --format="%(objectname)" >oids &&
183187
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)' '
234238
uri = $HTTPD_URL/bundle-5.bundle
235239
EOF
236240
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+
238246
git -C clone-from for-each-ref --format="%(objectname)" >oids &&
239247
git -C clone-any-fail cat-file --batch-check <oids &&
240248
@@ -323,7 +331,11 @@ test_expect_success 'clone bundle list (HTTP, any mode)' '
323331
uri = $HTTPD_URL/bundle-5.bundle
324332
EOF
325333
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+
327339
git -C clone-from for-each-ref --format="%(objectname)" >oids &&
328340
git -C clone-any-http cat-file --batch-check <oids &&
329341

0 commit comments

Comments
 (0)