Git development
 help / color / mirror / Atom feed
From: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>,
	Sverre Rabbelier <srabbelier@gmail.com>,
	git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Yann Dirson <ydirson@altern.org>
Subject: Re: [PATCH] rebase: use @{upstream} if no upstream specified
Date: Wed, 9 Feb 2011 20:15:20 -0500 (EST)	[thread overview]
Message-ID: <alpine.DEB.2.00.1102092005300.20937@debian> (raw)
In-Reply-To: <20110209041737.GD24346@elie>

On Tue, 8 Feb 2011, Jonathan Nieder wrote:

> Martin von Zweigbergk wrote:
> 
> > Changes to the text compared to before:
> >
> >  * "remote branch" became "upstream branch", even for git pull
> 
> Sensible for pull --rebase.  I'm not so sure about plain pull --- what
> if I am upstream and pulling from downstream?
> 
> >  * "You asked me to pull" became "You asked me to merge" or "You asked
> >    me to rebase", even for git pull
> 
> "To pull" would be clearer if the reader is new and unfamiliar with
> the details.
> 
> >  * Now printed to stderr, because I simply didn't think about it. Good
> >    or bad?
> 
> If this were a new message, I'd say stderr is better.
> 
> As is, the change to stderr seems relatively harmless, though I haven't
> thought about it deeply.  But a part of me likes to see functional
> changes isolated in separate commits to make tracking down bugs a
> little easier.

The patch below should address all of the above. See how you like the
new wording. The patch applies on top of the previous one to make the
changes clear. I will send a re-roll with all three patches squashed
soon as well.

Note that this patch makes the test cases introduced in the original
patch fail because of the error messages from 'git rebase' are now
written to stdout. I will of course fix that in the re-roll.

Thanks for reviewing.

/Martin


-- 8< --

diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index ff58d5b..be17ecb 100644
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -101,25 +101,25 @@ get_remote_merge_branch () {
 }
 
 error_on_missing_default_upstream () {
-	op_type="$1"
-	op_prep="$2"
-	example="$3"
-	documentation="$4"
+	cmd="$1"
+	op_type="$2"
+	op_prep="$3"
+	example="$4"
 	branch_name=$(git symbolic-ref -q HEAD)
 	if test -z "$branch_name"
 	then
-		die "You are not currently on a branch, so I cannot use any
+		echo "You are not currently on a branch, so I cannot use any
 'branch.<branchname>.merge' in your configuration file.
-Please specify which upstream branch you want to use on the command
+Please specify which branch you want to $op_type $op_prep on the command
 line and try again (e.g. '$example').
-See $documentation for details."
+See git-${cmd}(1) for details."
 	else
-		echo &2> "You asked me to $op_type without telling me which branch you
+		echo "You asked me to $cmd without telling me which branch you
 want to $op_type $op_prep, and 'branch.${branch_name#refs/heads/}.merge' in
 your configuration file does not tell me, either. Please
 specify which branch you want to use on the command line and
 try again (e.g. '$example').
-See $documentation for details.
+See git-${cmd}(1) for details.
 
 If you often $op_type $op_prep the same branch, you may want to
 use something like the following in your configuration file:
@@ -127,12 +127,13 @@ use something like the following in your configuration file:
     remote = <nickname>
     merge = <remote-ref>"
 		test rebase = "$op_type" &&
-		echo &2> "    rebase = true"
-		die "
+		echo "    rebase = true"
+		echo "
     [remote \"<nickname>\"]
     url = <url>
     fetch = <refspec>
 
 See git-config(1) for details."
 	fi
+	exit 1
 }
diff --git a/git-pull.sh b/git-pull.sh
index 8ec1d3d..2cdea26 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -165,8 +165,8 @@ error_on_no_merge_candidates () {
 		echo "for your current branch, you must specify a branch on the command line."
 	elif [ -z "$curr_branch" -o -z "$upstream" ]; then
 		. git-parse-remote
-		error_on_missing_default_upstream $op_type $op_prep \
-			"git pull <repository> <refspec>" "git-pull(1)"
+		error_on_missing_default_upstream "pull" $op_type $op_prep \
+			"git pull <repository> <refspec>"
 	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/git-rebase.sh b/git-rebase.sh
index 8b39cab..cff7aaa 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -366,8 +366,8 @@ then
 			--verify -q @{upstream})
 		then
 			. git-parse-remote
-			error_on_missing_default_upstream "rebase" "against" \
-				"git rebase <upstream branch>" "git-rebase(1)"
+			error_on_missing_default_upstream "rebase" "rebase" \
+				"against" "git rebase <upstream branch>"
 		fi
 		;;
 	*)	upstream_name="$1"

  reply	other threads:[~2011-02-10  1:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-08  0:37 [PATCH] rebase: use @{upstream} if no upstream specified Martin von Zweigbergk
2011-02-08 17:46 ` Sverre Rabbelier
2011-02-08 18:23   ` Martin von Zweigbergk
2011-02-08 18:27     ` Sverre Rabbelier
2011-02-08 22:05     ` Jonathan Nieder
2011-02-09  0:28       ` Martin von Zweigbergk
2011-02-09  1:50         ` Martin von Zweigbergk
2011-02-09  4:17           ` Jonathan Nieder
2011-02-10  1:15             ` Martin von Zweigbergk [this message]
2011-02-10  1:54 ` Martin von Zweigbergk
2011-02-10  2:25   ` Junio C Hamano
2011-02-10  2:46     ` Martin von Zweigbergk

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=alpine.DEB.2.00.1102092005300.20937@debian \
    --to=martin.von.zweigbergk@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=srabbelier@gmail.com \
    --cc=ydirson@altern.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