]> git.ipfire.org Git - thirdparty/git.git/commitdiff
clone: correctly report http_fetch errors
authorJeff King <peff@peff.net>
Mon, 17 Dec 2007 12:43:59 +0000 (07:43 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 17 Dec 2007 23:54:28 +0000 (15:54 -0800)
The exit status from curl was accidentally lost by the
'case' statement. We need to explicitly save it so that $?
doesn't get overwritten.

This improves the error message when fetching from an http
repository which has never had update-server-info run.
Previously, it would fail to note the fetch error and
produce multiple errors about the lack of origin branches.
It now correctly suggests running git-update-server-info.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-clone.sh

index 0ea3c24f59e32055e4d514e55fe3a6f6be095f9c..036a37e85c7e6c5dcdb53dcd67b30ad0ce946bfa 100755 (executable)
@@ -35,11 +35,12 @@ fi
 
 http_fetch () {
        # $1 = Remote, $2 = Local
-       curl -nsfL $curl_extra_args "$1" >"$2" ||
-               case $? in
-               126|127) exit ;;
-               *)       return $? ;;
-               esac
+       curl -nsfL $curl_extra_args "$1" >"$2"
+       curl_exit_status=$?
+       case $curl_exit_status in
+       126|127) exit ;;
+       *)       return $curl_exit_status ;;
+       esac
 }
 
 clone_dumb_http () {