{"thread":{"id":"23184","subject":"[PATCH] pull: mention \"pull\", not \"fetch\" in the error message.","startedAt":"2010-03-26T13:38:19Z","lastAt":"2010-03-28T17:14:35Z","messageCount":7,"participants":["Matthieu Moy","Michael J Gruber","Alex Riesen","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"137845","messageId":"1269610699-13176-1-git-send-email-Matthieu.Moy@imag.fr","threadId":"23184","inReplyTo":null,"subject":"[PATCH] pull: mention \"pull\", not \"fetch\" in the error message.","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2010-03-26T13:38:19Z","receivedAt":"2010-03-26T13:38:19Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"For newbies who've just been taught \"git push\", the error message\n\"Where do you want to fetch from today?\" is indeed confusing. Change it\nto \"Where do you want to pull from today?\" in case fetch was called from\npull.\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n builtin/fetch.c |    6 +++++-\n git-pull.sh     |    3 ++-\n 2 files changed, 7 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex 957be9f..f3246f5 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -842,8 +842,12 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)\n \tint ref_nr = 0;\n \tint exit_code;\n \n+\tchar *cmd = getenv(\"GIT_USER_COMMAND\");\n+\tif (cmd == NULL || cmd[0] == '\\0')\n+\t\tcmd = \"fetch\";\n+\n \tif (!remote)\n-\t\tdie(\"Where do you want to fetch from today?\");\n+\t\tdie(\"Where do you want to %s from today?\", cmd);\n \n \ttransport = transport_get(remote, NULL);\n \ttransport_set_verbosity(transport, verbosity, progress);\ndiff --git a/git-pull.sh b/git-pull.sh\nindex 1a4729f..abc233b 100755\n--- a/git-pull.sh\n+++ b/git-pull.sh\n@@ -216,7 +216,8 @@ test true = \"$rebase\" && {\n \tdone\n }\n orig_head=$(git rev-parse -q --verify HEAD)\n-git fetch $verbosity $progress --update-head-ok \"$@\" || exit 1\n+GIT_USER_COMMAND=pull \\\n+    git fetch $verbosity $progress --update-head-ok \"$@\" || exit 1\n \n curr_head=$(git rev-parse -q --verify HEAD)\n if test -n \"$orig_head\" && test \"$curr_head\" != \"$orig_head\"\n-- \n1.7.0.2.204.g8940d.dirty\n"},{"id":"137847","messageId":"4BACC241.4010608@drmicha.warpmail.net","threadId":"23184","inReplyTo":"1269610699-13176-1-git-send-email-Matthieu.Moy@imag.fr","subject":"Re: [PATCH] pull: mention \"pull\", not \"fetch\" in the error message.","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2010-03-26T14:18:41Z","receivedAt":"2010-03-26T14:18:41Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Matthieu Moy venit, vidit, dixit 26.03.2010 14:38:\n> For newbies who've just been taught \"git push\", the error message\n\nEven though newbies don't read git.git's commit messages, you may want\nto say \"pull\" here ;)\n\nOne way or the other, nothing beats the error messages in ident.c ;)\n\n> \"Where do you want to fetch from today?\" is indeed confusing. Change it\n> to \"Where do you want to pull from today?\" in case fetch was called from\n> pull.\n> \n> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n> ---\n>  builtin/fetch.c |    6 +++++-\n>  git-pull.sh     |    3 ++-\n>  2 files changed, 7 insertions(+), 2 deletions(-)\n> \n> diff --git a/builtin/fetch.c b/builtin/fetch.c\n> index 957be9f..f3246f5 100644\n> --- a/builtin/fetch.c\n> +++ b/builtin/fetch.c\n> @@ -842,8 +842,12 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)\n>  \tint ref_nr = 0;\n>  \tint exit_code;\n>  \n> +\tchar *cmd = getenv(\"GIT_USER_COMMAND\");\n> +\tif (cmd == NULL || cmd[0] == '\\0')\n> +\t\tcmd = \"fetch\";\n> +\n>  \tif (!remote)\n> -\t\tdie(\"Where do you want to fetch from today?\");\n> +\t\tdie(\"Where do you want to %s from today?\", cmd);\n>  \n>  \ttransport = transport_get(remote, NULL);\n>  \ttransport_set_verbosity(transport, verbosity, progress);\n> diff --git a/git-pull.sh b/git-pull.sh\n> index 1a4729f..abc233b 100755\n> --- a/git-pull.sh\n> +++ b/git-pull.sh\n> @@ -216,7 +216,8 @@ test true = \"$rebase\" && {\n>  \tdone\n>  }\n>  orig_head=$(git rev-parse -q --verify HEAD)\n> -git fetch $verbosity $progress --update-head-ok \"$@\" || exit 1\n> +GIT_USER_COMMAND=pull \\\n> +    git fetch $verbosity $progress --update-head-ok \"$@\" || exit 1\n>  \n>  curr_head=$(git rev-parse -q --verify HEAD)\n>  if test -n \"$orig_head\" && test \"$curr_head\" != \"$orig_head\"\n"},{"id":"137850","messageId":"vpqfx3nunvt.fsf@bauges.imag.fr","threadId":"23184","inReplyTo":"4BACC241.4010608@drmicha.warpmail.net","subject":"Re: [PATCH] pull: mention \"pull\", not \"fetch\" in the error message.","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2010-03-26T15:02:46Z","receivedAt":"2010-03-26T15:02:46Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n> Matthieu Moy venit, vidit, dixit 26.03.2010 14:38:\n>> For newbies who've just been taught \"git push\", the error message\n>\n> Even though newbies don't read git.git's commit messages, you may want\n> to say \"pull\" here ;)\n\nRight. I was just two letters away from the right message ;-).\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"137851","messageId":"1269615836-13995-1-git-send-email-Matthieu.Moy@imag.fr","threadId":"23184","inReplyTo":"4BACC241.4010608@drmicha.warpmail.net","subject":"[PATCH v2] pull: mention \"pull\", not \"fetch\" in the error message.","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2010-03-26T15:03:56Z","receivedAt":"2010-03-26T15:03:56Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"For newbies who've just been taught \"git pull\", the error message\n\"Where do you want to fetch from today?\" is indeed confusing. Change it\nto \"Where do you want to pull from today?\" in case fetch was called from\npull.\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\nJust fixed a typo in commit message since v1.\n\n builtin/fetch.c |    6 +++++-\n git-pull.sh     |    3 ++-\n 2 files changed, 7 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex 957be9f..f3246f5 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -842,8 +842,12 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)\n \tint ref_nr = 0;\n \tint exit_code;\n \n+\tchar *cmd = getenv(\"GIT_USER_COMMAND\");\n+\tif (cmd == NULL || cmd[0] == '\\0')\n+\t\tcmd = \"fetch\";\n+\n \tif (!remote)\n-\t\tdie(\"Where do you want to fetch from today?\");\n+\t\tdie(\"Where do you want to %s from today?\", cmd);\n \n \ttransport = transport_get(remote, NULL);\n \ttransport_set_verbosity(transport, verbosity, progress);\ndiff --git a/git-pull.sh b/git-pull.sh\nindex 1a4729f..abc233b 100755\n--- a/git-pull.sh\n+++ b/git-pull.sh\n@@ -216,7 +216,8 @@ test true = \"$rebase\" && {\n \tdone\n }\n orig_head=$(git rev-parse -q --verify HEAD)\n-git fetch $verbosity $progress --update-head-ok \"$@\" || exit 1\n+GIT_USER_COMMAND=pull \\\n+    git fetch $verbosity $progress --update-head-ok \"$@\" || exit 1\n \n curr_head=$(git rev-parse -q --verify HEAD)\n if test -n \"$orig_head\" && test \"$curr_head\" != \"$orig_head\"\n-- \n1.7.0.2.204.g8940d.dirty\n"},{"id":"137914","messageId":"20100326231209.GB6797@blimp.localdomain","threadId":"23184","inReplyTo":"1269615836-13995-1-git-send-email-Matthieu.Moy@imag.fr","subject":"Re: [PATCH v2] pull: mention \"pull\", not \"fetch\" in the error message.","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2010-03-26T23:12:10Z","receivedAt":"2010-03-26T23:12:10Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Matthieu Moy, Fri, Mar 26, 2010 16:03:56 +0100:\n> For newbies who've just been taught \"git pull\", the error message\n> \"Where do you want to fetch from today?\" is indeed confusing. Change it\n> to \"Where do you want to pull from today?\" in case fetch was called from\n> pull.\n...\n> @@ -842,8 +842,12 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)\n>  \tint ref_nr = 0;\n>  \tint exit_code;\n>  \n> +\tchar *cmd = getenv(\"GIT_USER_COMMAND\");\n\nIsn't the variable name a little too generic? USER_COMMAND doesn't make it\nclear that its only purpose is to pass a string \"pull\" to an error message\nwhich is never even seen under normal circumstances.\n"},{"id":"137937","messageId":"vpqy6hep2ns.fsf@bauges.imag.fr","threadId":"23184","inReplyTo":"20100326231209.GB6797@blimp.localdomain","subject":"Re: [PATCH v2] pull: mention \"pull\", not \"fetch\" in the error message.","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2010-03-27T08:52:23Z","receivedAt":"2010-03-27T08:52:23Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Alex Riesen <raa.lkml@gmail.com> writes:\n\n> Matthieu Moy, Fri, Mar 26, 2010 16:03:56 +0100:\n>> For newbies who've just been taught \"git pull\", the error message\n>> \"Where do you want to fetch from today?\" is indeed confusing. Change it\n>> to \"Where do you want to pull from today?\" in case fetch was called from\n>> pull.\n> ...\n>> @@ -842,8 +842,12 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)\n>>  \tint ref_nr = 0;\n>>  \tint exit_code;\n>>\n>> +\tchar *cmd = getenv(\"GIT_USER_COMMAND\");\n>\n> Isn't the variable name a little too generic? USER_COMMAND doesn't make it\n> clear that its only purpose is to pass a string \"pull\"\n\nIt is generic, so that the same variable can be reused elsewhere if\nneeded. When a command \"git foo\" calls internally \"git bar\", the\ninstance of \"git bar\" thinks it's executing the command \"bar\", but the\nuser thinks he just ran the command \"foo\". This variable lets git know\nthat and adapt its error message accordingly.\n\n> to an error message which is never even seen under normal\n> circumstances.\n\nFor some definition of \"never ever\" and/or \"normal circumstances\"\nonly, then:\n\n/tmp/test$ git init\nInitialized empty Git repository in /tmp/test/.git/\n/tmp/test$ git pull\nfatal: Where do you want to pull from today?\n\n(the confused newbie scenario isn't imaginary, it just happened to a\ncolleague of mine)\n\n--\nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"138019","messageId":"7vmxxs4bd0.fsf@alter.siamese.dyndns.org","threadId":"23184","inReplyTo":"1269615836-13995-1-git-send-email-Matthieu.Moy@imag.fr","subject":"Re: [PATCH v2] pull: mention \"pull\", not \"fetch\" in the error message.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-03-28T17:14:35Z","receivedAt":"2010-03-28T17:14:35Z","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> For newbies who've just been taught \"git pull\", the error message\n> \"Where do you want to fetch from today?\" is indeed confusing. Change it\n> to \"Where do you want to pull from today?\" in case fetch was called from\n> pull.\n>\n> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n> ---\n> Just fixed a typo in commit message since v1.\n>\n>  builtin/fetch.c |    6 +++++-\n>  git-pull.sh     |    3 ++-\n>  2 files changed, 7 insertions(+), 2 deletions(-)\n>\n> diff --git a/builtin/fetch.c b/builtin/fetch.c\n> index 957be9f..f3246f5 100644\n> --- a/builtin/fetch.c\n> +++ b/builtin/fetch.c\n> @@ -842,8 +842,12 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)\n>  \tint ref_nr = 0;\n>  \tint exit_code;\n>  \n> +\tchar *cmd = getenv(\"GIT_USER_COMMAND\");\n> +\tif (cmd == NULL || cmd[0] == '\\0')\n> +\t\tcmd = \"fetch\";\n> +\n>  \tif (!remote)\n> -\t\tdie(\"Where do you want to fetch from today?\");\n> +\t\tdie(\"Where do you want to %s from today?\", cmd);\n\n>  \ttransport = transport_get(remote, NULL);\n>  \ttransport_set_verbosity(transport, verbosity, progress);\n> diff --git a/git-pull.sh b/git-pull.sh\n> index 1a4729f..abc233b 100755\n> --- a/git-pull.sh\n> +++ b/git-pull.sh\n> @@ -216,7 +216,8 @@ test true = \"$rebase\" && {\n>  \tdone\n>  }\n>  orig_head=$(git rev-parse -q --verify HEAD)\n> -git fetch $verbosity $progress --update-head-ok \"$@\" || exit 1\n> +GIT_USER_COMMAND=pull \\\n> +    git fetch $verbosity $progress --update-head-ok \"$@\" || exit 1\n\nI personally don't think this is a good change.  When somebody writes a\nwrapper around \"git pull\" to \"make it easier\", the name of the command\nthat is given in the message will still be \"pull\", and you will have \nexactly the same issue again.\n\nIt was never the intent of the use of word \"fetch\" in the original message\nto give the name of one among many commands (i.e. the message was not\nabout \"fetch vs pull\").  The word was to convey more abstract concept of\ngetting new changes that are available on the other end.\n\nAn alternative that does not introduce layering violation of making the\nlower level porcelain aware of what the caller is doing might be to make\nit even more bland, \"Where do you want to get changes from today?\", or\nsomething.\n\nOr we could even make it even more explicit by saying \"Where do you want\nto go today?\", which was what the original meant to mock ;-).\n"}]}