Skip to content

Commit

Permalink
pull: use $curr_branch_short more
Browse files Browse the repository at this point in the history
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.  Simplify the code by using
$curr_branch_short instead of setting $curr_branch to the same
shortened value.

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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
René Scharfe authored and Junio C Hamano committed Sep 8, 2013
1 parent d521abf commit b07f729
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions git-pull.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b07f729

Please sign in to comment.