* git-clone: Unobvious error messages when update-server-info has not been run
@ 2007-12-17 10:55 Sebastian Harl
2007-12-17 12:43 ` Jeff King
0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Harl @ 2007-12-17 10:55 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 891 bytes --]
Hi,
I was just trying to clone a repository using http but missed to run
git-update-server-info on the server side. git-clone aborted with the
following error messages:
% git clone http://some/repo.git
Initialized empty Git repository in /path/repo/.git/
cat: /path/repo/.git/refs/remotes/origin/master: No such file or directory
cd: 482: can't cd to /path/repo/.git/refs/remotes/origin
fatal: : not a valid SHA1
fatal: Not a valid object name HEAD
It's kind of hard to guess where the error comes from in this case (I blamed
Git at first). Is there some way to improve the error message in a case like
this?
TIA,
Sebastian
--
Sebastian "tokkee" Harl +++ GnuPG-ID: 0x8501C7FC +++ http://tokkee.org/
Those who would give up Essential Liberty to purchase a little Temporary
Safety, deserve neither Liberty nor Safety. -- Benjamin Franklin
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: git-clone: Unobvious error messages when update-server-info has not been run
2007-12-17 10:55 git-clone: Unobvious error messages when update-server-info has not been run Sebastian Harl
@ 2007-12-17 12:43 ` Jeff King
2007-12-17 15:47 ` Sebastian Harl
2007-12-18 12:23 ` Gerrit Pape
0 siblings, 2 replies; 4+ messages in thread
From: Jeff King @ 2007-12-17 12:43 UTC (permalink / raw)
To: Sebastian Harl; +Cc: Junio C Hamano, Gerrit Pape, git
On Mon, Dec 17, 2007 at 11:55:41AM +0100, Sebastian Harl wrote:
> I was just trying to clone a repository using http but missed to run
> git-update-server-info on the server side. git-clone aborted with the
> following error messages:
>
> % git clone http://some/repo.git
> Initialized empty Git repository in /path/repo/.git/
> cat: /path/repo/.git/refs/remotes/origin/master: No such file or directory
> cd: 482: can't cd to /path/repo/.git/refs/remotes/origin
> fatal: : not a valid SHA1
> fatal: Not a valid object name HEAD
>
> It's kind of hard to guess where the error comes from in this case (I blamed
> Git at first). Is there some way to improve the error message in a case like
> this?
git-clone is supposed to detect this condition, but there was a bug in
the error checking code. Can you confirm that this patch fixes it?
Gerrit, I think was caused by your f28dd477 (it is a funny shell
interaction that the non-followed case branch resets $?, but it behaves
the same with bash and dash).
-- >8 --
clone: correctly report http_fetch errors
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>
---
git-clone.sh | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/git-clone.sh b/git-clone.sh
index 68085a3..9a160ee 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -56,11 +56,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 () {
--
1.5.4.rc0.1145.gef733-dirty
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: git-clone: Unobvious error messages when update-server-info has not been run
2007-12-17 12:43 ` Jeff King
@ 2007-12-17 15:47 ` Sebastian Harl
2007-12-18 12:23 ` Gerrit Pape
1 sibling, 0 replies; 4+ messages in thread
From: Sebastian Harl @ 2007-12-17 15:47 UTC (permalink / raw)
To: Jeff King; +Cc: Junio C Hamano, Gerrit Pape, git
[-- Attachment #1: Type: text/plain, Size: 1274 bytes --]
Hi Jeff,
On Mon, Dec 17, 2007 at 07:43:59AM -0500, Jeff King wrote:
> On Mon, Dec 17, 2007 at 11:55:41AM +0100, Sebastian Harl wrote:
> > I was just trying to clone a repository using http but missed to run
> > git-update-server-info on the server side. git-clone aborted with the
> > following error messages:
> >
> > % git clone http://some/repo.git
> > Initialized empty Git repository in /path/repo/.git/
> > cat: /path/repo/.git/refs/remotes/origin/master: No such file or directory
> > cd: 482: can't cd to /path/repo/.git/refs/remotes/origin
> > fatal: : not a valid SHA1
> > fatal: Not a valid object name HEAD
> >
> > It's kind of hard to guess where the error comes from in this case (I blamed
> > Git at first). Is there some way to improve the error message in a case like
> > this?
>
> git-clone is supposed to detect this condition, but there was a bug in
> the error checking code. Can you confirm that this patch fixes it?
Yes, this patch seems to fix it. Thanks.
Cheers,
Sebastian
--
Sebastian "tokkee" Harl +++ GnuPG-ID: 0x8501C7FC +++ http://tokkee.org/
Those who would give up Essential Liberty to purchase a little Temporary
Safety, deserve neither Liberty nor Safety. -- Benjamin Franklin
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: git-clone: Unobvious error messages when update-server-info has not been run
2007-12-17 12:43 ` Jeff King
2007-12-17 15:47 ` Sebastian Harl
@ 2007-12-18 12:23 ` Gerrit Pape
1 sibling, 0 replies; 4+ messages in thread
From: Gerrit Pape @ 2007-12-18 12:23 UTC (permalink / raw)
To: Jeff King; +Cc: Sebastian Harl, Junio C Hamano, git
On Mon, Dec 17, 2007 at 07:43:59AM -0500, Jeff King wrote:
> git-clone is supposed to detect this condition, but there was a bug in
> the error checking code. Can you confirm that this patch fixes it?
>
> Gerrit, I think was caused by your f28dd477 (it is a funny shell
> interaction that the non-followed case branch resets $?, but it behaves
> the same with bash and dash).
Yes, I didn't expect that, but can confirm the problem and the fix.
Thanks, Gerrit.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-12-18 12:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-17 10:55 git-clone: Unobvious error messages when update-server-info has not been run Sebastian Harl
2007-12-17 12:43 ` Jeff King
2007-12-17 15:47 ` Sebastian Harl
2007-12-18 12:23 ` Gerrit Pape
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 NNTP newsgroup(s).