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
864864
865865if test ! -z " $switch_to "
866866then
867+ GIT_REFLOG_ACTION=" $GIT_REFLOG_ACTION : checkout $switch_to "
867868 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
869872fi
870873
871874orig_head=$( git rev-parse --verify HEAD) || die " No HEAD?"
@@ -1007,6 +1010,7 @@ has_action "$todo" ||
10071010
10081011test -d " $rewritten " || test -n " $force_rebase " || skip_unnecessary_picks
10091012
1013+ GIT_REFLOG_ACTION=" $GIT_REFLOG_ACTION : checkout $onto_name "
10101014output git checkout $onto || die_abort " could not detach HEAD"
10111015git update-ref ORIG_HEAD $orig_head
10121016do_rest
Original file line number Diff line number Diff line change 542542 if test -z " $force_rebase "
543543 then
544544 # 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 " --
546548 say " $( eval_gettext " Current branch \$ branch_name is up to date." ) "
547549 finish_rebase
548550 exit 0
@@ -568,7 +570,9 @@ test "$type" = interactive && run_specific_rebase
568570
569571# Detach HEAD and reset the tree
570572say " $( 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"
572576git update-ref ORIG_HEAD $orig_head
573577
574578# 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' '
926926 test L = $(git cat-file commit HEAD | sed -ne \$p)
927927'
928928
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+
929944test_expect_success ' rebase -i respects core.commentchar' '
930945 git reset --hard &&
931946 git checkout E^0 &&
You can’t perform that action at this time.
0 commit comments