git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
* [PATCH] git-clone: better error message if curl program is missing
@ 2007-09-07 17:13 Gerrit Pape
  2007-09-07 21:19 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Gerrit Pape @ 2007-09-07 17:13 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

If the curl program is not available, 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 testing for availability of the
curl program before running it, the error output now is

 Initialized empty Git repository in /tmp/puppet/.git/
 The curl program is not available

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

Signed-off-by: Gerrit Pape <pape@smarden.org>
---
 git-clone.sh |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/git-clone.sh b/git-clone.sh
index 18003ab..834371d 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -34,6 +34,8 @@ fi
 
 http_fetch () {
 	# $1 = Remote, $2 = Local
+	type curl >/dev/null 2>&1 ||
+	    die "The curl program is not available"
 	curl -nsfL $curl_extra_args "$1" >"$2"
 }
 
-- 
1.5.3.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] git-clone: better error message if curl program is missing
  2007-09-07 17:13 [PATCH] git-clone: better error message if curl program is missing Gerrit Pape
@ 2007-09-07 21:19 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2007-09-07 21:19 UTC (permalink / raw)
  To: Gerrit Pape; +Cc: git

Gerrit Pape <pape@smarden.org> writes:

> If the curl program is not available, 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

Perhaps we should die at this point so that...

>  Cannot get remote repository information.
>  Perhaps git-update-server-info needs to be run there?

the user does not have to see this.

In other words, instead of this:

>  http_fetch () {
>  	# $1 = Remote, $2 = Local
> +	type curl >/dev/null 2>&1 ||
> +	    die "The curl program is not available"
>  	curl -nsfL $curl_extra_args "$1" >"$2"
>  }

something like this, perhaps:

	http_fetch () {
        	# $1 = remote, $2 = local
               	curl -nsfL $curl_extra_args "$1" >"$2" || exit
	}

Then the shell would say "curl: command not found" and we would
stop.

I am just hestating to use "type" there (yeah, I know mergetool
has one but that one is not as close to the core of the workflow
as git-fetch is).

BTW, isn't it a packaging bug not to depend git-fetch on curl?

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-09-07 21:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-07 17:13 [PATCH] git-clone: better error message if curl program is missing Gerrit Pape
2007-09-07 21:19 ` Junio C Hamano

Code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).