Thread (9 messages) flat view 9 messages, 2 authors, 2017-12-16
STALE3202d

[PATCH v2 3/3] rebase: rebasing can also be done when HEAD is detached

From: Kaartic Sivaraam <hidden>
Date: 2017-11-27 17:21:50
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

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 <redacted>
---

 git-rebase.sh | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/git-rebase.sh b/git-rebase.sh
index 3f8d99e99..9cce1483a 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -602,11 +602,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_or_commit is up to date.")"
+		if test "$branch_or_commit" = "HEAD" &&
+			 !(git symbolic-ref -q HEAD)
+		then
+			say "$(eval_gettext "HEAD is up to date.")"
+		else
+			say "$(eval_gettext "Current branch \$branch_or_commit is up to date.")"
+		fi
 		finish_rebase
 		exit 0
 	else
-		say "$(eval_gettext "Current branch \$branch_or_commit is up to date, rebase forced.")"
+		if test "$branch_or_commit" = "HEAD" &&
+			 !(git symbolic-ref -q HEAD)
+		then
+			say "$(eval_gettext "HEAD is up to date, rebase forced.")"
+		else
+			say "$(eval_gettext "Current branch \$branch_or_commit is up to date, rebase forced.")"
+		fi
 	fi
 fi
 
-- 
2.15.0.345.gf926f18f3
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help