summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaartic Sivaraam <kaartic.sivaraam@gmail.com>2017-11-27 22:51:04 +0530
committerJunio C Hamano <gitster@pobox.com>2017-12-14 13:02:13 -0800
commitb8b66831afcfcc6a1203ec10f08b52d27c9a6c15 (patch)
treea81d09e228120c8e8b846344eeeb4fb6e50d0145
parent79a4254f080a9c90365da7f4100a8bdd63ee5bf2 (diff)
downloadgit-b8b66831afcfcc6a1203ec10f08b52d27c9a6c15.tar.gz
rebase: rebasing can also be done when HEAD is detached
Attempting to rebase when the HEAD is detached and is already up to date with upstream (so there's nothing to do), the following message is shown Current branch HEAD is up to date. which is clearly wrong as HEAD is not a branch. Handle the special case of HEAD correctly to give a more precise error message. Signed-off-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xgit-rebase.sh16
1 files changed, 14 insertions, 2 deletions
diff --git a/git-rebase.sh b/git-rebase.sh
index e5adb596a0..f3dd864437 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -601,11 +601,23 @@ then
test -z "$switch_to" ||
GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: checkout $switch_to" \
git checkout -q "$switch_to" --
- say "$(eval_gettext "Current branch \$branch_name is up to date.")"
+ if test "$branch_name" = "HEAD" &&
+ !(git symbolic-ref -q HEAD)
+ then
+ say "$(eval_gettext "HEAD is up to date.")"
+ else
+ say "$(eval_gettext "Current branch \$branch_name is up to date.")"
+ fi
finish_rebase
exit 0
else
- say "$(eval_gettext "Current branch \$branch_name is up to date, rebase forced.")"
+ if test "$branch_name" = "HEAD" &&
+ !(git symbolic-ref -q HEAD)
+ then
+ say "$(eval_gettext "HEAD is up to date, rebase forced.")"
+ else
+ say "$(eval_gettext "Current branch \$branch_name is up to date, rebase forced.")"
+ fi
fi
fi