Skip to content

Commit b07f729

Browse files
rscharfegitster
authored andcommitted
pull: use $curr_branch_short more
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 <[email protected]> Signed-off-by: Rene Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d521abf commit b07f729

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

git-pull.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,8 @@ error_on_no_merge_candidates () {
166166
op_prep=with
167167
fi
168168

169-
curr_branch=${curr_branch#refs/heads/}
170-
upstream=$(git config "branch.$curr_branch.merge")
171-
remote=$(git config "branch.$curr_branch.remote")
169+
upstream=$(git config "branch.$curr_branch_short.merge")
170+
remote=$(git config "branch.$curr_branch_short.remote")
172171

173172
if [ $# -gt 1 ]; then
174173
if [ "$rebase" = true ]; then

0 commit comments

Comments
 (0)