git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pull: mention "pull", not "fetch" in the error message.
@ 2010-03-26 13:38 Matthieu Moy
  2010-03-26 14:18 ` Michael J Gruber
  0 siblings, 1 reply; 7+ messages in thread
From: Matthieu Moy @ 2010-03-26 13:38 UTC (permalink / raw)
  To: git, gitster; +Cc: Matthieu Moy

For newbies who've just been taught "git push", the error message
"Where do you want to fetch from today?" is indeed confusing. Change it
to "Where do you want to pull from today?" in case fetch was called from
pull.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
 builtin/fetch.c |    6 +++++-
 git-pull.sh     |    3 ++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/builtin/fetch.c b/builtin/fetch.c
index 957be9f..f3246f5 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -842,8 +842,12 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)
 	int ref_nr = 0;
 	int exit_code;
 
+	char *cmd = getenv("GIT_USER_COMMAND");
+	if (cmd == NULL || cmd[0] == '\0')
+		cmd = "fetch";
+
 	if (!remote)
-		die("Where do you want to fetch from today?");
+		die("Where do you want to %s from today?", cmd);
 
 	transport = transport_get(remote, NULL);
 	transport_set_verbosity(transport, verbosity, progress);
diff --git a/git-pull.sh b/git-pull.sh
index 1a4729f..abc233b 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -216,7 +216,8 @@ test true = "$rebase" && {
 	done
 }
 orig_head=$(git rev-parse -q --verify HEAD)
-git fetch $verbosity $progress --update-head-ok "$@" || exit 1
+GIT_USER_COMMAND=pull \
+    git fetch $verbosity $progress --update-head-ok "$@" || exit 1
 
 curr_head=$(git rev-parse -q --verify HEAD)
 if test -n "$orig_head" && test "$curr_head" != "$orig_head"
-- 
1.7.0.2.204.g8940d.dirty

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

end of thread, other threads:[~2010-03-28 17:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-26 13:38 [PATCH] pull: mention "pull", not "fetch" in the error message Matthieu Moy
2010-03-26 14:18 ` Michael J Gruber
2010-03-26 15:02   ` Matthieu Moy
2010-03-26 15:03   ` [PATCH v2] " Matthieu Moy
2010-03-26 23:12     ` Alex Riesen
2010-03-27  8:52       ` Matthieu Moy
2010-03-28 17:14     ` Junio C Hamano

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).