{"thread":{"id":"9822","subject":"[PATCH] git-clone: better error message if curl program is missing","startedAt":"2007-09-07T17:13:59Z","lastAt":"2007-09-07T21:19:32Z","messageCount":2,"participants":["Gerrit Pape","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"52924","messageId":"20070907171400.28590.qmail@d780fac1e27de6.315fe32.mid.smarden.org","threadId":"9822","inReplyTo":null,"subject":"[PATCH] git-clone: better error message if curl program is missing","fromName":"Gerrit Pape","fromEmail":"pape@smarden.org","sentAt":"2007-09-07T17:13:59Z","receivedAt":"2007-09-07T17:13:59Z","isPatch":true,"sender":{"key":"pape@smarden.org","avatar":"https://avatars.githubusercontent.com/u/143170252?v=4"},"body":"If the curl program is not available, and git clone is started to clone a\nrepository through http, this is the output\n\n Initialized empty Git repository in /tmp/puppet/.git/\n /usr/bin/git-clone: line 37: curl: command not found\n Cannot get remote repository information.\n Perhaps git-update-server-info needs to be run there?\n\nThis patch improves the error message by testing for availability of the\ncurl program before running it, the error output now is\n\n Initialized empty Git repository in /tmp/puppet/.git/\n The curl program is not available\n\nAdrian Bridgett noticed this and reported through\n http://bugs.debian.org/440976\n\nSigned-off-by: Gerrit Pape <pape@smarden.org>\n---\n git-clone.sh |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/git-clone.sh b/git-clone.sh\nindex 18003ab..834371d 100755\n--- a/git-clone.sh\n+++ b/git-clone.sh\n@@ -34,6 +34,8 @@ fi\n \n http_fetch () {\n \t# $1 = Remote, $2 = Local\n+\ttype curl >/dev/null 2>&1 ||\n+\t    die \"The curl program is not available\"\n \tcurl -nsfL $curl_extra_args \"$1\" >\"$2\"\n }\n \n-- \n1.5.3.1\n"},{"id":"52948","messageId":"7vtzq62mxn.fsf@gitster.siamese.dyndns.org","threadId":"9822","inReplyTo":"20070907171400.28590.qmail@d780fac1e27de6.315fe32.mid.smarden.org","subject":"Re: [PATCH] git-clone: better error message if curl program is missing","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-09-07T21:19:32Z","receivedAt":"2007-09-07T21:19:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Gerrit Pape <pape@smarden.org> writes:\n\n> If the curl program is not available, and git clone is started to clone a\n> repository through http, this is the output\n>\n>  Initialized empty Git repository in /tmp/puppet/.git/\n>  /usr/bin/git-clone: line 37: curl: command not found\n\nPerhaps we should die at this point so that...\n\n>  Cannot get remote repository information.\n>  Perhaps git-update-server-info needs to be run there?\n\nthe user does not have to see this.\n\nIn other words, instead of this:\n\n>  http_fetch () {\n>  \t# $1 = Remote, $2 = Local\n> +\ttype curl >/dev/null 2>&1 ||\n> +\t    die \"The curl program is not available\"\n>  \tcurl -nsfL $curl_extra_args \"$1\" >\"$2\"\n>  }\n\nsomething like this, perhaps:\n\n\thttp_fetch () {\n        \t# $1 = remote, $2 = local\n               \tcurl -nsfL $curl_extra_args \"$1\" >\"$2\" || exit\n\t}\n\nThen the shell would say \"curl: command not found\" and we would\nstop.\n\nI am just hestating to use \"type\" there (yeah, I know mergetool\nhas one but that one is not as close to the core of the workflow\nas git-fetch is).\n\nBTW, isn't it a packaging bug not to depend git-fetch on curl?\n"}]}