git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Lukashov <michael.lukashov@gmail.com>
To: git@vger.kernel.org
Cc: Michael Lukashov <michael.lukashov@gmail.com>
Subject: [PATCH] pull --all: fix error message when current branch is not tracking remote branch
Date: Tue,  2 Mar 2010 21:52:21 +0000	[thread overview]
Message-ID: <1267566741-5784-1-git-send-email-michael.lukashov@gmail.com> (raw)

If current branch doesn't track remote branch, "git pull --all" produces
a confusing message:

  You asked to pull from the remote '--all', but did not specify
  a branch. Because this is not the default configured remote
  for your current branch, you must specify a branch on the command line.

To fix this, simply move up check if current branch is configured to track
remote branch.

This patch applies on top of branch 'next' of git.git repository.

Signed-off-by: Michael Lukashov <michael.lukashov@gmail.com>
---
 git-pull.sh             |   20 ++++++++++----------
 t/t5521-pull-options.sh |    5 +++++
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/git-pull.sh b/git-pull.sh
index 38331a8..df16ea0 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -147,16 +147,6 @@ error_on_no_merge_candidates () {
 		echo "among the refs that you just fetched."
 		echo "Generally this means that you provided a wildcard refspec which had no"
 		echo "matches on the remote end."
-	elif [ $# -gt 0 ] && [ "$1" != "$remote" ]; then
-		echo "You asked to pull from the remote '$1', but did not specify"
-		echo "a branch. Because this is not the default configured remote"
-		echo "for your current branch, you must specify a branch on the command line."
-	elif [ -z "$curr_branch" ]; then
-		echo "You are not currently on a branch, so I cannot use any"
-		echo "'branch.<branchname>.merge' in your configuration file."
-		echo "Please specify which remote branch you want to use on the command"
-		echo "line and try again (e.g. 'git pull <repository> <refspec>')."
-		echo "See git-pull(1) for details."
 	elif [ -z "$upstream" ]; then
 		echo "You asked me to pull without telling me which branch you"
 		echo "want to $op_type $op_prep, and 'branch.${curr_branch}.merge' in"
@@ -179,6 +169,16 @@ error_on_no_merge_candidates () {
 		echo "    fetch = <refspec>"
 		echo
 		echo "See git-config(1) for details."
+	elif [ $# -gt 0 ] && [ "$1" != "$remote" ]; then
+		echo "You asked to pull from the remote '$1', but did not specify"
+		echo "a branch. Because this is not the default configured remote"
+		echo "for your current branch, you must specify a branch on the command line."
+	elif [ -z "$curr_branch" ]; then
+		echo "You are not currently on a branch, so I cannot use any"
+		echo "'branch.<branchname>.merge' in your configuration file."
+		echo "Please specify which remote branch you want to use on the command"
+		echo "line and try again (e.g. 'git pull <repository> <refspec>')."
+		echo "See git-pull(1) for details."
 	else
 		echo "Your configuration specifies to $op_type $op_prep the ref '${upstream#refs/heads/}'"
 		echo "from the remote, but no such ref was fetched."
diff --git a/t/t5521-pull-options.sh b/t/t5521-pull-options.sh
index 1b06691..64ba39f 100755
--- a/t/t5521-pull-options.sh
+++ b/t/t5521-pull-options.sh
@@ -87,6 +87,11 @@ test_expect_success 'git pull --all' '
 		merge = refs/heads/master
 	EOF
 	git pull --all
+	) &&
+	(cd clonedmulti &&
+	git checkout -b side &&
+	test_must_fail git pull --all 2>err &&
+	grep "You asked me to pull without telling me which branch" err
 	)
 '
 
-- 
1.7.0.1.1704.g1a7f8

             reply	other threads:[~2010-03-02 21:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-02 21:52 Michael Lukashov [this message]
2010-03-08 20:26 ` [PATCH] pull --all: fix error message when current branch is not tracking remote branch Michael Lukashov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1267566741-5784-1-git-send-email-michael.lukashov@gmail.com \
    --to=michael.lukashov@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).