All of lore.kernel.org
 help / color / mirror / Atom feed
From: "René Scharfe" <l.s.r@web.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Felipe Contreras <felipe.contreras@gmail.com>, git@vger.kernel.org
Subject: [PATCH] branch: use $curr_branch_short more
Date: Sat, 31 Aug 2013 10:10:56 +0200	[thread overview]
Message-ID: <5221A510.2020206@web.de> (raw)
In-Reply-To: <xmqq38pqwlyl.fsf@gitster.dls.corp.google.com>

One of the first things git-pull.sh does is setting $curr_branch to
the target of HEAD and $curr_branch_short to the same but with the
leading "refs/heads/" removed.  Use $curr_branch_short in the function
error_on_no_merge_candidates instead of removing the prefix from
$curr_branch directly.

The only other use of $curr_branch in that function doesn't have to
be replaced with $curr_branch_short because it just checks if the
string is empty.  That property is the same with or without the prefix
unless HEAD points to "refs/heads/" alone, which is invalid.

Noticed-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
---
 git-pull.sh | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/git-pull.sh b/git-pull.sh
index f0df41c..d8b2708 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -166,9 +166,8 @@ error_on_no_merge_candidates () {
 		op_prep=with
 	fi
 
-	curr_branch=${curr_branch#refs/heads/}
-	upstream=$(git config "branch.$curr_branch.merge")
-	remote=$(git config "branch.$curr_branch.remote")
+	upstream=$(git config "branch.$curr_branch_short.merge")
+	remote=$(git config "branch.$curr_branch_short.remote")
 
 	if [ $# -gt 1 ]; then
 		if [ "$rebase" = true ]; then
-- 
1.8.4

  parent reply	other threads:[~2013-08-31  8:11 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-30 21:56 [PATCH 0/6] Trivial cleanups and fixes Felipe Contreras
2013-08-30 21:56 ` [PATCH 1/6] reset: trivial refactoring Felipe Contreras
2013-08-31  3:36   ` Junio C Hamano
2013-08-30 21:56 ` [PATCH 2/6] branch: trivial style fix Felipe Contreras
2013-08-31  3:36   ` Junio C Hamano
2013-08-30 21:56 ` [PATCH 3/6] rebase: trivial style fixes Felipe Contreras
2013-08-31  3:49   ` Junio C Hamano
2013-08-30 21:56 ` [PATCH 4/6] reset: trivial style cleanup Felipe Contreras
2013-08-31  3:49   ` Junio C Hamano
2013-08-30 21:56 ` [PATCH 5/6] add: " Felipe Contreras
2013-08-31  3:37   ` Junio C Hamano
2013-08-30 21:56 ` [PATCH 6/6] pull: trivial cleanup Felipe Contreras
2013-08-31  3:58   ` Junio C Hamano
2013-08-31  7:56     ` Felipe Contreras
2013-08-31  8:10     ` René Scharfe [this message]
2013-08-31  8:22       ` [PATCH] branch: use $curr_branch_short more Felipe Contreras
2013-08-31  9:11         ` René Scharfe
2013-08-31  9:22           ` Felipe Contreras
2013-08-31 10:28             ` René Scharfe
2013-08-31 17:20               ` Felipe Contreras
2013-09-08 15:21                 ` René Scharfe
2013-09-08 23:13                   ` Felipe Contreras
2013-09-15 11:42                     ` René Scharfe
2013-09-15 13:02                       ` Felipe Contreras
2013-09-03 16:56         ` Junio C Hamano
2013-09-08 15:21       ` [PATCH] pull: " René Scharfe

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=5221A510.2020206@web.de \
    --to=l.s.r@web.de \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.