Thread (10 messages) flat view 10 messages, 2 authors, 2016-06-15
DORMANTno replies

Revision v1 of 3 in this series.

Revisions (3)
  1. v1 current
  2. v2 [diff vs current]
  3. v3 [diff vs current]

[PATCH 7/8] rebase: write better reflog messages

From: Ramkumar Ramachandra <hidden>
Date: 2016-06-15 22:57:48
Subsystem: the rest · Maintainer: Linus Torvalds

Now that the "checkout" invoked internally from "rebase" knows to honor
GIT_REFLOG_ACTION, we can start to use it to write a better reflog
message when "rebase anotherbranch", "rebase --onto branch",
etc. internally checks out the new fork point.  We will write:

  rebase: checkout master

instead of the old

  rebase

Signed-off-by: Ramkumar Ramachandra <redacted>
Signed-off-by: Junio C Hamano <redacted>
---
 git-rebase--am.sh | 2 ++
 git-rebase.sh     | 8 +++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/git-rebase--am.sh b/git-rebase--am.sh
index 34e3102..d4bade8 100644
--- a/git-rebase--am.sh
+++ b/git-rebase--am.sh
@@ -40,9 +40,11 @@ else
 		rm -f "$GIT_DIR/rebased-patches"
 		case "$head_name" in
 		refs/heads/*)
+			GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: checkout $head_name"
 			git checkout -q "$head_name"
 			;;
 		*)
+			GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: checkout $orig_head"
 			git checkout -q "$orig_head"
 			;;
 		esac
diff --git a/git-rebase.sh b/git-rebase.sh
index d0c11a9..b43600d 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -543,7 +543,11 @@ then
 	if test -z "$force_rebase"
 	then
 		# Lazily switch to the target branch if needed...
-		test -z "$switch_to" || git checkout "$switch_to" --
+		if test -n "$switch_to"
+		then
+			GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: checkout $switch_to"
+			git checkout "$switch_to" --
+		fi
 		say "$(eval_gettext "Current branch \$branch_name is up to date.")"
 		exit 0
 	else
@@ -568,6 +572,8 @@ test "$type" = interactive && run_specific_rebase
 
 # Detach HEAD and reset the tree
 say "$(gettext "First, rewinding head to replay your work on top of it...")"
+
+GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: checkout $onto_name"
 git checkout -q "$onto^0" || die "could not detach HEAD"
 git update-ref ORIG_HEAD $orig_head
 
-- 
1.8.3.1.456.gb7f4cb6
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help