File tree Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -864,8 +864,11 @@ comment_for_reflog start
864
864
865
865
if test ! -z " $switch_to "
866
866
then
867
+ GIT_REFLOG_ACTION=" $GIT_REFLOG_ACTION : checkout $switch_to "
867
868
output git checkout " $switch_to " -- ||
868
- die " Could not checkout $switch_to "
869
+ die " Could not checkout $switch_to "
870
+
871
+ comment_for_reflog start
869
872
fi
870
873
871
874
orig_head=$( git rev-parse --verify HEAD) || die " No HEAD?"
@@ -1007,6 +1010,7 @@ has_action "$todo" ||
1007
1010
1008
1011
test -d " $rewritten " || test -n " $force_rebase " || skip_unnecessary_picks
1009
1012
1013
+ GIT_REFLOG_ACTION=" $GIT_REFLOG_ACTION : checkout $onto_name "
1010
1014
output git checkout $onto || die_abort " could not detach HEAD"
1011
1015
git update-ref ORIG_HEAD $orig_head
1012
1016
do_rest
Original file line number Diff line number Diff line change 542
542
if test -z " $force_rebase "
543
543
then
544
544
# Lazily switch to the target branch if needed...
545
- test -z " $switch_to " || git checkout " $switch_to " --
545
+ test -z " $switch_to " ||
546
+ GIT_REFLOG_ACTION=" $GIT_REFLOG_ACTION : checkout $switch_to " \
547
+ git checkout " $switch_to " --
546
548
say " $( eval_gettext " Current branch \$ branch_name is up to date." ) "
547
549
finish_rebase
548
550
exit 0
@@ -568,7 +570,9 @@ test "$type" = interactive && run_specific_rebase
568
570
569
571
# Detach HEAD and reset the tree
570
572
say " $( gettext " First, rewinding head to replay your work on top of it..." ) "
571
- git checkout -q " $onto ^0" || die " could not detach HEAD"
573
+
574
+ GIT_REFLOG_ACTION=" $GIT_REFLOG_ACTION : checkout $onto_name " \
575
+ git checkout -q " $onto ^0" || die " could not detach HEAD"
572
576
git update-ref ORIG_HEAD $orig_head
573
577
574
578
# If the $onto is a proper descendant of the tip of the branch, then
Original file line number Diff line number Diff line change @@ -926,6 +926,21 @@ test_expect_success 'rebase --edit-todo can be used to modify todo' '
926
926
test L = $(git cat-file commit HEAD | sed -ne \$p)
927
927
'
928
928
929
+ test_expect_success ' rebase -i produces readable reflog' '
930
+ git reset --hard &&
931
+ git branch -f branch-reflog-test H &&
932
+ git rebase -i --onto I F branch-reflog-test &&
933
+ cat >expect <<-\EOF &&
934
+ rebase -i (start): checkout I
935
+ rebase -i (pick): G
936
+ rebase -i (pick): H
937
+ rebase -i (finish): returning to refs/heads/branch-reflog-test
938
+ EOF
939
+ tail -n 4 .git/logs/HEAD |
940
+ sed -e "s/.* //" >actual &&
941
+ test_cmp expect actual
942
+ '
943
+
929
944
test_expect_success ' rebase -i respects core.commentchar' '
930
945
git reset --hard &&
931
946
git checkout E^0 &&
You can’t perform that action at this time.
0 commit comments