Propagate errors from fetch-pack correctly to git-fetch.
When git-fetch-pack fails, the command does not notice the failure and instead pretended nothing was fetched and there was nothing wrong. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Sep 12, 2005 at 22:20 UTC
22c67ca88ec65c4f278e8c82b2d98f3bd025238b
1 file changed
+9
-2
git-fetch.sh
+9
-2
@@ -205,9 +205,16 @@ case "$remote" in
205
http://* | https://* | rsync://* )
206
;; # we are already done.
207
*)
208
- git-fetch-pack "$remote" $rref |
208
+ (
209
+ git-fetch-pack "$remote" $rref || echo failed "$remote"
210
+ ) |
211
while read sha1 remote_name
212
do
213
+ case "$sha1" in
214
+ failed)
215
+ echo >&2 "Fetch failure: $remote"
216
+ exit 1 ;;
217
+ esac
218
found=
219
single_force=
220
for ref in $refs
@@ -225,7 +232,7 @@ http://* | https://* | rsync://* )
232
233
local_name=$(expr "$found" : '[^:]*:\(.*\)')
234
append_fetch_head "$sha1" "$remote" "$remote_name" "$remote_nick" "$local_name"
228
- done
235
+ done || exit
236
;;
237
esac
238