rebase: Fix the detection of fast-forwarding of the current branch to upstream.
Previously, a rebasing operation with on a branch that is just tracking an upstream branch would output a confusing "Nothing to do" due to no patches being given to git-am. The test brings the behaviour back into line with that of just before e646c9c8c0aa995eac284ea0a2117add19c4461c. Signed-off-by: Robert Shearman <rob@codeweavers.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Robert Shearman committed
Jul 27, 2006 at 10:32 UTC
83c31614ceae2612b7cdba40e6401716fe854cd2
1 file changed
+5
-8
git-rebase.sh
+5
-8
@@ -266,14 +266,11 @@ onto=$(git-rev-parse --verify "${onto_name}^0") || exit
266
267
# Check if we are already based on $onto, but this should be
268
# 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"
271
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
274
fi
275
276
# Rewind the head to "$onto"; this saves our current head in ORIG_HEAD.
@@ -281,7 +278,7 @@ git-reset --hard "$onto"
278
279
# If the $onto is a proper descendant of the tip of the branch, then
280
# we just fast forwarded.
284
-if test "$mb" = "$onto"
281
+if test "$mb" = "$branch"
282
then
283
echo >&2 "Fast-forwarded $branch to $newbase."
284
exit 0