[PATCH v2] pull: mention "pull", not "fetch" in the error message.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For newbies who've just been taught "git pull", 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@xxxxxxx>
---
Just fixed a typo in commit message since v1.

 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]