git-clone: improve error message if curl program is missing or not executable
authorGerrit Pape <pape@smarden.org>
Thu, 13 Sep 2007 11:36:22 +0000 (11:36 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 14 Sep 2007 05:39:22 +0000 (22:39 -0700)
If the curl program is not available (or not executable), and git clone is
started to clone a repository through http, this is the output

Initialized empty Git repository in /tmp/puppet/.git/
/usr/bin/git-clone: line 37: curl: command not found
Cannot get remote repository information.
Perhaps git-update-server-info needs to be run there?

This patch improves the error message by checking the return code when
running curl to exit immediately if it's 126 or 127; the error output now
is

Initialized empty Git repository in /tmp/puppet/.git/
/usr/bin/git-clone: line 37: curl: command not found

Adrian Bridgett noticed this and reported through
http://bugs.debian.org/440976

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-clone.sh
index 18003ab4b39ad0a7848cc20db2f6ad55e1291264..5e582fe247892fa7dffc44556c939863c36edc35 100755 (executable)
@@ -34,7 +34,11 @@ fi
 
 http_fetch () {
        # $1 = Remote, $2 = Local
-       curl -nsfL $curl_extra_args "$1" >"$2"
+       curl -nsfL $curl_extra_args "$1" >"$2" ||
+               case $? in
+               126|127) exit ;;
+               *)       return $? ;;
+               esac
 }
 
 clone_dumb_http () {