{"thread":{"id":"11317","subject":"git-clone: Unobvious error messages when update-server-info has not been run","startedAt":"2007-12-17T10:55:41Z","lastAt":"2007-12-18T12:23:05Z","messageCount":4,"participants":["Sebastian Harl","Jeff King","Gerrit Pape"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"63396","messageId":"20071217105541.GG14889@albany.tokkee.org","threadId":"11317","inReplyTo":null,"subject":"git-clone: Unobvious error messages when update-server-info has not been run","fromName":"Sebastian Harl","fromEmail":"sh@tokkee.org","sentAt":"2007-12-17T10:55:41Z","receivedAt":"2007-12-17T10:55:41Z","isPatch":false,"sender":{"key":"sh@tokkee.org","avatar":"https://gravatar.com/avatar/c19b9c37bd63e5d1dabe8d222904921fb807d53d1d8d41af758a16c066eeb59c?d=mp&s=160"},"body":"Hi,\n\nI was just trying to clone a repository using http but missed to run\ngit-update-server-info on the server side. git-clone aborted with the\nfollowing error messages:\n\n  % git clone http://some/repo.git\n  Initialized empty Git repository in /path/repo/.git/\n  cat: /path/repo/.git/refs/remotes/origin/master: No such file or directory\n  cd: 482: can't cd to /path/repo/.git/refs/remotes/origin\n  fatal: : not a valid SHA1\n  fatal: Not a valid object name HEAD\n\nIt's kind of hard to guess where the error comes from in this case (I blamed\nGit at first). Is there some way to improve the error message in a case like\nthis?\n\nTIA,\nSebastian\n\n-- \nSebastian \"tokkee\" Harl +++ GnuPG-ID: 0x8501C7FC +++ http://tokkee.org/\n\nThose who would give up Essential Liberty to purchase a little Temporary\nSafety, deserve neither Liberty nor Safety.         -- Benjamin Franklin\n\n"},{"id":"63418","messageId":"20071217124359.GA20800@coredump.intra.peff.net","threadId":"11317","inReplyTo":"20071217105541.GG14889@albany.tokkee.org","subject":"Re: git-clone: Unobvious error messages when update-server-info has not been run","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-12-17T12:43:59Z","receivedAt":"2007-12-17T12:43:59Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Dec 17, 2007 at 11:55:41AM +0100, Sebastian Harl wrote:\n\n> I was just trying to clone a repository using http but missed to run\n> git-update-server-info on the server side. git-clone aborted with the\n> following error messages:\n> \n>   % git clone http://some/repo.git\n>   Initialized empty Git repository in /path/repo/.git/\n>   cat: /path/repo/.git/refs/remotes/origin/master: No such file or directory\n>   cd: 482: can't cd to /path/repo/.git/refs/remotes/origin\n>   fatal: : not a valid SHA1\n>   fatal: Not a valid object name HEAD\n> \n> It's kind of hard to guess where the error comes from in this case (I blamed\n> Git at first). Is there some way to improve the error message in a case like\n> this?\n\ngit-clone is supposed to detect this condition, but there was a bug in\nthe error checking code. Can you confirm that this patch fixes it?\n\nGerrit, I think was caused by your f28dd477 (it is a funny shell\ninteraction that the non-followed case branch resets $?, but it behaves\nthe same with bash and dash).\n\n-- >8 --\nclone: correctly report http_fetch errors\n\nThe exit status from curl was accidentally lost by the\n'case' statement. We need to explicitly save it so that $?\ndoesn't get overwritten.\n\nThis improves the error message when fetching from an http\nrepository which has never had update-server-info run.\nPreviously, it would fail to note the fetch error and\nproduce multiple errors about the lack of origin branches.\nIt now correctly suggests running git-update-server-info.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n git-clone.sh |   11 ++++++-----\n 1 files changed, 6 insertions(+), 5 deletions(-)\n\ndiff --git a/git-clone.sh b/git-clone.sh\nindex 68085a3..9a160ee 100755\n--- a/git-clone.sh\n+++ b/git-clone.sh\n@@ -56,11 +56,12 @@ fi\n \n http_fetch () {\n \t# $1 = Remote, $2 = Local\n-\tcurl -nsfL $curl_extra_args \"$1\" >\"$2\" ||\n-\t\tcase $? in\n-\t\t126|127) exit ;;\n-\t\t*)\t return $? ;;\n-\t\tesac\n+\tcurl -nsfL $curl_extra_args \"$1\" >\"$2\"\n+\tcurl_exit_status=$?\n+\tcase $curl_exit_status in\n+\t126|127) exit ;;\n+\t*)\t return $curl_exit_status ;;\n+\tesac\n }\n \n clone_dumb_http () {\n-- \n1.5.4.rc0.1145.gef733-dirty\n"},{"id":"63431","messageId":"20071217154742.GI14889@albany.tokkee.org","threadId":"11317","inReplyTo":"20071217124359.GA20800@coredump.intra.peff.net","subject":"Re: git-clone: Unobvious error messages when update-server-info has not been run","fromName":"Sebastian Harl","fromEmail":"sh@tokkee.org","sentAt":"2007-12-17T15:47:42Z","receivedAt":"2007-12-17T15:47:42Z","isPatch":false,"sender":{"key":"sh@tokkee.org","avatar":"https://gravatar.com/avatar/c19b9c37bd63e5d1dabe8d222904921fb807d53d1d8d41af758a16c066eeb59c?d=mp&s=160"},"body":"Hi Jeff,\n\nOn Mon, Dec 17, 2007 at 07:43:59AM -0500, Jeff King wrote:\n> On Mon, Dec 17, 2007 at 11:55:41AM +0100, Sebastian Harl wrote:\n> > I was just trying to clone a repository using http but missed to run\n> > git-update-server-info on the server side. git-clone aborted with the\n> > following error messages:\n> > \n> >   % git clone http://some/repo.git\n> >   Initialized empty Git repository in /path/repo/.git/\n> >   cat: /path/repo/.git/refs/remotes/origin/master: No such file or directory\n> >   cd: 482: can't cd to /path/repo/.git/refs/remotes/origin\n> >   fatal: : not a valid SHA1\n> >   fatal: Not a valid object name HEAD\n> > \n> > It's kind of hard to guess where the error comes from in this case (I blamed\n> > Git at first). Is there some way to improve the error message in a case like\n> > this?\n> \n> git-clone is supposed to detect this condition, but there was a bug in\n> the error checking code. Can you confirm that this patch fixes it?\n\nYes, this patch seems to fix it. Thanks.\n\nCheers,\nSebastian\n\n-- \nSebastian \"tokkee\" Harl +++ GnuPG-ID: 0x8501C7FC +++ http://tokkee.org/\n\nThose who would give up Essential Liberty to purchase a little Temporary\nSafety, deserve neither Liberty nor Safety.         -- Benjamin Franklin\n\n"},{"id":"63596","messageId":"20071218122305.6582.qmail@8b22a037a8fc83.315fe32.mid.smarden.org","threadId":"11317","inReplyTo":"20071217124359.GA20800@coredump.intra.peff.net","subject":"Re: git-clone: Unobvious error messages when update-server-info has not been run","fromName":"Gerrit Pape","fromEmail":"pape@smarden.org","sentAt":"2007-12-18T12:23:05Z","receivedAt":"2007-12-18T12:23:05Z","isPatch":false,"sender":{"key":"pape@smarden.org","avatar":"https://avatars.githubusercontent.com/u/143170252?v=4"},"body":"On Mon, Dec 17, 2007 at 07:43:59AM -0500, Jeff King wrote:\n> git-clone is supposed to detect this condition, but there was a bug in\n> the error checking code. Can you confirm that this patch fixes it?\n> \n> Gerrit, I think was caused by your f28dd477 (it is a funny shell\n> interaction that the non-followed case branch resets $?, but it behaves\n> the same with bash and dash).\n\nYes, I didn't expect that, but can confirm the problem and the fix.\n\nThanks, Gerrit.\n"}]}