Skip to content

Commit bc9e1b8

Browse files
author
Junio C Hamano
committed
Merge branch 'rs/rebase'
* rs/rebase: rebase: Make the fast-fowarding message more user-friendly by using branch names instead of SHA1 IDs. rebase: Fix the detection of fast-forwarding of the current branch to upstream.
2 parents 056d6d4 + d587ed1 commit bc9e1b8

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

git-rebase.sh

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -266,24 +266,21 @@ onto=$(git-rev-parse --verify "${onto_name}^0") || exit
266266

267267
# Check if we are already based on $onto, but this should be
268268
# done only when upstream and onto are the same.
269-
if test "$upstream" = "$onto"
269+
mb=$(git-merge-base "$onto" "$branch")
270+
if test "$upstream" = "$onto" && test "$mb" = "$onto"
270271
then
271-
mb=$(git-merge-base "$onto" "$branch")
272-
if test "$mb" = "$onto"
273-
then
274-
echo >&2 "Current branch $branch_name is up to date."
275-
exit 0
276-
fi
272+
echo >&2 "Current branch $branch_name is up to date."
273+
exit 0
277274
fi
278275

279276
# Rewind the head to "$onto"; this saves our current head in ORIG_HEAD.
280277
git-reset --hard "$onto"
281278

282279
# If the $onto is a proper descendant of the tip of the branch, then
283280
# we just fast forwarded.
284-
if test "$mb" = "$onto"
281+
if test "$mb" = "$branch"
285282
then
286-
echo >&2 "Fast-forwarded $branch to $newbase."
283+
echo >&2 "Fast-forwarded $branch_name to $onto_name."
287284
exit 0
288285
fi
289286

0 commit comments

Comments
 (0)