{"thread":{"id":"18756","subject":"[PATCH] git-pull.sh: better warning message for \"git pull\" on detached head.","startedAt":"2009-04-06T21:14:47Z","lastAt":"2009-04-08T07:24:03Z","messageCount":7,"participants":["Matthieu Moy","Mike Ralphson","Finn Arne Gangstad","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"110631","messageId":"1239052487-6936-1-git-send-email-Matthieu.Moy@imag.fr","threadId":"18756","inReplyTo":null,"subject":"[PATCH] git-pull.sh: better warning message for \"git pull\" on detached head.","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2009-04-06T21:14:47Z","receivedAt":"2009-04-06T21:14:47Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Otherwise, git complains about not finding a branch to pull from in\n'branch..merge', which is hardly understandable.\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n git-pull.sh |   43 ++++++++++++++++++++++++++-----------------\n 1 files changed, 26 insertions(+), 17 deletions(-)\n\ndiff --git a/git-pull.sh b/git-pull.sh\nindex 8a26763..ab29a9e 100755\n--- a/git-pull.sh\n+++ b/git-pull.sh\n@@ -90,23 +90,32 @@ error_on_no_merge_candidates () {\n \n \tcurr_branch=${curr_branch#refs/heads/}\n \n-\techo \"You asked me to pull without telling me which branch you\"\n-\techo \"want to merge with, and 'branch.${curr_branch}.merge' in\"\n-\techo \"your configuration file does not tell me either.  Please\"\n-\techo \"name which branch you want to merge on the command line and\"\n-\techo \"try again (e.g. 'git pull <repository> <refspec>').\"\n-\techo \"See git-pull(1) for details on the refspec.\"\n-\techo\n-\techo \"If you often merge with the same branch, you may want to\"\n-\techo \"configure the following variables in your configuration\"\n-\techo \"file:\"\n-\techo\n-\techo \"    branch.${curr_branch}.remote = <nickname>\"\n-\techo \"    branch.${curr_branch}.merge = <remote-ref>\"\n-\techo \"    remote.<nickname>.url = <url>\"\n-\techo \"    remote.<nickname>.fetch = <refspec>\"\n-\techo\n-\techo \"See git-config(1) for details.\"\n+\tif [ -z \"$curr_branch\" ]; then\n+\t\techo \"You asked me to pull without telling me which branch you want\"\n+\t\techo \"to merge with, and you are on a detached HEAD, so I cannot\"\n+\t\techo \"know from 'branch.<branchname>.merge' in your configuration\"\n+\t\techo \"file.  Please name which branch you want to merge on the command\"\n+\t\techo \"line and try again (e.g. 'git pull <repository> <refspec>').\"\n+\t\techo \"See git-pull(1) for details on the refspec.\"\n+\telse\n+\t\techo \"You asked me to pull without telling me which branch you\"\n+\t\techo \"want to merge with, and 'branch.${curr_branch}.merge' in\"\n+\t\techo \"your configuration file does not tell me either.\tPlease\"\n+\t\techo \"name which branch you want to merge on the command line and\"\n+\t\techo \"try again (e.g. 'git pull <repository> <refspec>').\"\n+\t\techo \"See git-pull(1) for details on the refspec.\"\n+\t\techo\n+\t\techo \"If you often merge with the same branch, you may want to\"\n+\t\techo \"configure the following variables in your configuration\"\n+\t\techo \"file:\"\n+\t\techo\n+\t\techo \"    branch.${curr_branch}.remote = <nickname>\"\n+\t\techo \"    branch.${curr_branch}.merge = <remote-ref>\"\n+\t\techo \"    remote.<nickname>.url = <url>\"\n+\t\techo \"    remote.<nickname>.fetch = <refspec>\"\n+\t\techo\n+\t\techo \"See git-config(1) for details.\"\n+\tfi\n \texit 1\n }\n \n-- \n1.6.2.2.449.g92961.dirty\n"},{"id":"110688","messageId":"e2b179460904070224o3057c6efk6930bd1249adb0fe@mail.gmail.com","threadId":"18756","inReplyTo":"1239052487-6936-1-git-send-email-Matthieu.Moy@imag.fr","subject":"Re: [PATCH] git-pull.sh: better warning message for \"git pull\" on detached head.","fromName":"Mike Ralphson","fromEmail":"mike.ralphson@gmail.com","sentAt":"2009-04-07T09:24:35Z","receivedAt":"2009-04-07T09:24:35Z","isPatch":true,"sender":{"key":"mike.ralphson@gmail.com","avatar":"https://avatars.githubusercontent.com/u/21603?v=4"},"body":"2009/4/6 Matthieu Moy <Matthieu.Moy@imag.fr>:\n> Otherwise, git complains about not finding a branch to pull from in\n> 'branch..merge', which is hardly understandable.\n\n> +               echo \"You asked me to pull without telling me which branch you want\"\n> +               echo \"to merge with, and you are on a detached HEAD, so I cannot\"\n> +               echo \"know from 'branch.<branchname>.merge' in your configuration\"\n> +               echo \"file.  Please name which branch you want to merge on the command\"\n\n'Know from' in this sense is a little confusing. Maybe something like:\n\ns/so I cannot know from 'branch.<branchname>.merge' in your\nconfiguration file/ \\\nso I cannot use any 'branch.<branchname>.merge' from your configuration file\n\n?\n\n> +               echo \"your configuration file does not tell me either.  Please\"\n> +               echo \"name which branch you want to merge on the command line and\"\n> +               echo \"try again (e.g. 'git pull <repository> <refspec>').\"\n\nI know you haven't changed this part, but as it's included in the\npatch, what we're asking the user to do is to 'specify' the branch to\nmerge, not to 'name' it.\n\nMike\n"},{"id":"110694","messageId":"1239098181-10360-1-git-send-email-Matthieu.Moy@imag.fr","threadId":"18756","inReplyTo":"e2b179460904070224o3057c6efk6930bd1249adb0fe@mail.gmail.com","subject":"[PATCH v2] git-pull.sh: better warning message for \"git pull\" on detached head.","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2009-04-07T09:56:21Z","receivedAt":"2009-04-07T09:56:21Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Otherwise, git complains about not finding a branch to pull from in\n'branch..merge', which is hardly understandable. While we're there,\nreword the sentences slightly.\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n> 'Know from' in this sense is a little confusing. Maybe something like:\n> \n> s/so I cannot know from 'branch.<branchname>.merge' in your\n> configuration file/ \\\n> so I cannot use any 'branch.<branchname>.merge' from your configuration file\n\nMakes sense, yes.\n\n> I know you haven't changed this part, but as it's included in the\n> patch, what we're asking the user to do is to 'specify' the branch to\n> merge, not to 'name' it.\n\nApplied too.\n\nI also added s/details on the refspec/details/ in the pointer to\ngit-pull(1) since first patch.\n\n git-pull.sh |   43 ++++++++++++++++++++++++++-----------------\n 1 files changed, 26 insertions(+), 17 deletions(-)\n\ndiff --git a/git-pull.sh b/git-pull.sh\nindex 8a26763..6d5f558 100755\n--- a/git-pull.sh\n+++ b/git-pull.sh\n@@ -90,23 +90,32 @@ error_on_no_merge_candidates () {\n \n \tcurr_branch=${curr_branch#refs/heads/}\n \n-\techo \"You asked me to pull without telling me which branch you\"\n-\techo \"want to merge with, and 'branch.${curr_branch}.merge' in\"\n-\techo \"your configuration file does not tell me either.  Please\"\n-\techo \"name which branch you want to merge on the command line and\"\n-\techo \"try again (e.g. 'git pull <repository> <refspec>').\"\n-\techo \"See git-pull(1) for details on the refspec.\"\n-\techo\n-\techo \"If you often merge with the same branch, you may want to\"\n-\techo \"configure the following variables in your configuration\"\n-\techo \"file:\"\n-\techo\n-\techo \"    branch.${curr_branch}.remote = <nickname>\"\n-\techo \"    branch.${curr_branch}.merge = <remote-ref>\"\n-\techo \"    remote.<nickname>.url = <url>\"\n-\techo \"    remote.<nickname>.fetch = <refspec>\"\n-\techo\n-\techo \"See git-config(1) for details.\"\n+\tif [ -z \"$curr_branch\" ]; then\n+\t\techo \"You asked me to pull without telling me which branch you want\"\n+\t\techo \"to merge with, and you are on a detached HEAD, so I cannot\"\n+\t\techo \"use any 'branch.<branchname>.merge' in your configuration\"\n+\t\techo \"file.  Please specify which branch you want to merge on the command\"\n+\t\techo \"line and try again (e.g. 'git pull <repository> <refspec>').\"\n+\t\techo \"See git-pull(1) for details.\"\n+\telse\n+\t\techo \"You asked me to pull without telling me which branch you\"\n+\t\techo \"want to merge with, and 'branch.${curr_branch}.merge' in\"\n+\t\techo \"your configuration file does not tell me either.\tPlease\"\n+\t\techo \"specify which branch you want to merge on the command line and\"\n+\t\techo \"try again (e.g. 'git pull <repository> <refspec>').\"\n+\t\techo \"See git-pull(1) for details.\"\n+\t\techo\n+\t\techo \"If you often merge with the same branch, you may want to\"\n+\t\techo \"configure the following variables in your configuration\"\n+\t\techo \"file:\"\n+\t\techo\n+\t\techo \"    branch.${curr_branch}.remote = <nickname>\"\n+\t\techo \"    branch.${curr_branch}.merge = <remote-ref>\"\n+\t\techo \"    remote.<nickname>.url = <url>\"\n+\t\techo \"    remote.<nickname>.fetch = <refspec>\"\n+\t\techo\n+\t\techo \"See git-config(1) for details.\"\n+\tfi\n \texit 1\n }\n \n-- \n1.6.2.2.449.g92961.dirty\n"},{"id":"110695","messageId":"20090407104145.GA22658@pvv.org","threadId":"18756","inReplyTo":"1239098181-10360-1-git-send-email-Matthieu.Moy@imag.fr","subject":"Re: [PATCH v2] git-pull.sh: better warning message for \"git pull\" on detached head.","fromName":"Finn Arne Gangstad","fromEmail":"finnag@pvv.org","sentAt":"2009-04-07T10:41:46Z","receivedAt":"2009-04-07T10:41:46Z","isPatch":true,"sender":{"key":"finnag@pvv.org","avatar":"https://gravatar.com/avatar/b421ddd58c3f0f93aa473e17b98bb8d53c221fef741746bc8cb59fae4ec6d95e?d=mp&s=160"},"body":"On Tue, Apr 07, 2009 at 11:56:21AM +0200, Matthieu Moy wrote:\n> Otherwise, git complains about not finding a branch to pull from in\n> 'branch..merge', which is hardly understandable. While we're there,\n> reword the sentences slightly.\n> [...]\n> +\tif [ -z \"$curr_branch\" ]; then\n> +\t\techo \"You asked me to pull without telling me which branch you want\"\n> +\t\techo \"to merge with, and you are on a detached HEAD, so I cannot\"\n> [...]\n\nIn this case why can't we just do\n\necho \"You are currently not on any branch.\"\n\nor\n\necho \"git pull cannot be run without arguments unless you are on a branch.\"\n\nAnd possibly also something like this:\n\necho \"Usage: git pull <repository> <refspec>.\"\necho \" See git-pull(1) for details.\"\necho\n\nIf you need all the verbosity this error otherwise gives, \"detached\nHEAD\" is probably going to be confusing?\n\n- Finn Arne\n"},{"id":"110697","messageId":"vpqvdpgn19y.fsf@bauges.imag.fr","threadId":"18756","inReplyTo":"20090407104145.GA22658@pvv.org","subject":"Re: [PATCH v2] git-pull.sh: better warning message for \"git pull\" on detached head.","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2009-04-07T11:36:41Z","receivedAt":"2009-04-07T11:36:41Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Finn Arne Gangstad <finnag@pvv.org> writes:\n\n> On Tue, Apr 07, 2009 at 11:56:21AM +0200, Matthieu Moy wrote:\n>> Otherwise, git complains about not finding a branch to pull from in\n>> 'branch..merge', which is hardly understandable. While we're there,\n>> reword the sentences slightly.\n>> [...]\n>> +\tif [ -z \"$curr_branch\" ]; then\n>> +\t\techo \"You asked me to pull without telling me which branch you want\"\n>> +\t\techo \"to merge with, and you are on a detached HEAD, so I cannot\"\n>> [...]\n>\n> In this case why can't we just do\n>\n> echo \"You are currently not on any branch.\"\n\nWell, I would understand this as \"you can't pull when you're not on a\nbranch\", which would be incorrect.\n\n> echo \"git pull cannot be run without arguments unless you are on a branch.\"\n\nThis is better (less missleading).\n\n> And possibly also something like this:\n>\n> echo \"Usage: git pull <repository> <refspec>.\"\n> echo \" See git-pull(1) for details.\"\n\nThis usage string would be incorrect, repository and refspec are not\nalways mandatory. To be correct, it should be\nUsage: git pull [<repository> <refspec>]\nand then you're back to the problem of having to explain why they are\noptionnal.\n\n> If you need all the verbosity this error otherwise gives, \"detached\n> HEAD\" is probably going to be confusing?\n\nGrepping the source, \"not on a branch\" seems more widely used than\n\"detached head\" in the UI (including in another place of git-pull.sh),\nso, yes, something like this would be better:\n\n\tif [ -z \"$curr_branch\" ]; then\n\t\techo \"You are not currently on a branch, so I cannot use any\"\n\t\techo \"'branch.<branchname>.merge' in your configuration file.\"\n\t\techo \"Please specify which branch you want to merge on the command\"\n\t\techo \"line and try again (e.g. 'git pull <repository> <refspec>').\"\n\t\techo \"See git-pull(1) for details.\"\n\telse\n\n-- \nMatthieu\n"},{"id":"110761","messageId":"7vk55wvutb.fsf@gitster.siamese.dyndns.org","threadId":"18756","inReplyTo":"vpqvdpgn19y.fsf@bauges.imag.fr","subject":"Re: [PATCH v2] git-pull.sh: better warning message for \"git pull\" on detached head.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-04-08T00:43:44Z","receivedAt":"2009-04-08T00:43:44Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@imag.fr> writes:\n\n> Grepping the source, \"not on a branch\" seems more widely used than\n> \"detached head\" in the UI (including in another place of git-pull.sh),\n> so, yes, something like this would be better:\n\nYeah, \"not on a branch\" sounds like the best wording.\n"},{"id":"110805","messageId":"1239175443-7693-1-git-send-email-Matthieu.Moy@imag.fr","threadId":"18756","inReplyTo":"7vk55wvutb.fsf@gitster.siamese.dyndns.org","subject":"[PATCH] git-pull.sh: better warning message for \"git pull\" on detached head.","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2009-04-08T07:24:03Z","receivedAt":"2009-04-08T07:24:03Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Otherwise, git complains about not finding a branch to pull from in\n'branch..merge', which is hardly understandable. While we're there,\nreword the sentences slightly.\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n git-pull.sh |   42 +++++++++++++++++++++++++-----------------\n 1 files changed, 25 insertions(+), 17 deletions(-)\n\ndiff --git a/git-pull.sh b/git-pull.sh\nindex 8a26763..8c75027 100755\n--- a/git-pull.sh\n+++ b/git-pull.sh\n@@ -90,23 +90,31 @@ error_on_no_merge_candidates () {\n \n \tcurr_branch=${curr_branch#refs/heads/}\n \n-\techo \"You asked me to pull without telling me which branch you\"\n-\techo \"want to merge with, and 'branch.${curr_branch}.merge' in\"\n-\techo \"your configuration file does not tell me either.  Please\"\n-\techo \"name which branch you want to merge on the command line and\"\n-\techo \"try again (e.g. 'git pull <repository> <refspec>').\"\n-\techo \"See git-pull(1) for details on the refspec.\"\n-\techo\n-\techo \"If you often merge with the same branch, you may want to\"\n-\techo \"configure the following variables in your configuration\"\n-\techo \"file:\"\n-\techo\n-\techo \"    branch.${curr_branch}.remote = <nickname>\"\n-\techo \"    branch.${curr_branch}.merge = <remote-ref>\"\n-\techo \"    remote.<nickname>.url = <url>\"\n-\techo \"    remote.<nickname>.fetch = <refspec>\"\n-\techo\n-\techo \"See git-config(1) for details.\"\n+\tif [ -z \"$curr_branch\" ]; then\n+\t\techo \"You are not currently on a branch, so I cannot use any\"\n+\t\techo \"'branch.<branchname>.merge' in your configuration file.\"\n+\t\techo \"Please specify which branch you want to merge on the command\"\n+\t\techo \"line and try again (e.g. 'git pull <repository> <refspec>').\"\n+\t\techo \"See git-pull(1) for details.\"\n+\telse\n+\t\techo \"You asked me to pull without telling me which branch you\"\n+\t\techo \"want to merge with, and 'branch.${curr_branch}.merge' in\"\n+\t\techo \"your configuration file does not tell me either.\tPlease\"\n+\t\techo \"specify which branch you want to merge on the command line and\"\n+\t\techo \"try again (e.g. 'git pull <repository> <refspec>').\"\n+\t\techo \"See git-pull(1) for details.\"\n+\t\techo\n+\t\techo \"If you often merge with the same branch, you may want to\"\n+\t\techo \"configure the following variables in your configuration\"\n+\t\techo \"file:\"\n+\t\techo\n+\t\techo \"    branch.${curr_branch}.remote = <nickname>\"\n+\t\techo \"    branch.${curr_branch}.merge = <remote-ref>\"\n+\t\techo \"    remote.<nickname>.url = <url>\"\n+\t\techo \"    remote.<nickname>.fetch = <refspec>\"\n+\t\techo\n+\t\techo \"See git-config(1) for details.\"\n+\tfi\n \texit 1\n }\n \n-- \n1.6.2.2.449.g92961.dirty\n"}]}