Detect ls-remote failure properly.
The part that can fail is before the pipe, so we need to propagate the error properly to the main process. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Sep 13, 2005 at 13:16 UTC
a5cd85e084458bf573d0d29fa79c4e1ad7973ed7
1 file changed
+12
-3
git-ls-remote.sh
+12
-3
@@ -42,12 +42,16 @@ http://* | https://* )
42
if [ -n "$GIT_SSL_NO_VERIFY" ]; then
43
curl_extra_args="-k"
44
fi
45
- curl -nsf $curl_extra_args "$peek_repo/info/refs" || exit 1
45
+ curl -nsf $curl_extra_args "$peek_repo/info/refs" ||
46
+ echo "failed slurping"
47
;;
48
49
rsync://* )
50
mkdir $tmpdir
50
- rsync -rq "$peek_repo/refs" $tmpdir || exit 1
51
+ rsync -rq "$peek_repo/refs" $tmpdir || {
52
+ echo "failed slurping"
53
+ exit
54
+ }
55
(cd $tmpdir && find refs -type f) |
56
while read path
57
do
@@ -58,12 +62,17 @@ rsync://* )
62
;;
63
64
* )
61
- git-peek-remote "$peek_repo"
65
+ git-peek-remote "$peek_repo" ||
66
+ echo "failed slurping"
67
;;
68
esac |
69
sort -t ' ' -k 2 |
70
while read sha1 path
71
do
72
+ case "$sha1" in
73
+ failed)
74
+ die "Failed to find remote refs"
75
+ esac
76
case "$path" in
77
refs/heads/*)
78
group=heads ;;