diff options
author | Phillip Wood <phillip.wood@dunelm.org.uk> | 2019-08-19 09:18:22 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-08-19 22:27:13 (GMT) |
commit | a47ba3c77713d04953e0630f8e7109084329078a (patch) | |
tree | 0e175d60468de31cf99ebdf30c3f1329928aae03 /t/t3429-rebase-edit-todo.sh | |
parent | 450efe2d53b67f67b5efc11172ed0706cbd4f776 (diff) | |
download | git-a47ba3c77713d04953e0630f8e7109084329078a.zip git-a47ba3c77713d04953e0630f8e7109084329078a.tar.gz git-a47ba3c77713d04953e0630f8e7109084329078a.tar.bz2 |
rebase -i: check for updated todo after squash and reword
While a rebase is stopped for the user to edit a commit message it can
be convenient for them to also edit the todo list. The scripted version
of rebase supported this but the C version does not. We already check to
see if the todo list has been updated by an exec command so extend this
to rewords and squashes. It only costs a single stat call to do this so
it should not affect the speed of the rebase (especially as it has just
stopped for the user to edit a message)
Note that for squashes the editor may be opened on a different pick to
the squash itself as we edit the message at the end of a chain fixups
and squashes.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3429-rebase-edit-todo.sh')
-rwxr-xr-x | t/t3429-rebase-edit-todo.sh | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/t/t3429-rebase-edit-todo.sh b/t/t3429-rebase-edit-todo.sh index 76f6d30..8739cb6 100755 --- a/t/t3429-rebase-edit-todo.sh +++ b/t/t3429-rebase-edit-todo.sh @@ -3,9 +3,15 @@ test_description='rebase should reread the todo file if an exec modifies it' . ./test-lib.sh +. "$TEST_DIRECTORY"/lib-rebase.sh + +test_expect_success 'setup' ' + test_commit first file && + test_commit second file && + test_commit third file +' test_expect_success 'rebase exec modifies rebase-todo' ' - test_commit initial && todo=.git/rebase-merge/git-rebase-todo && git rebase HEAD -x "echo exec touch F >>$todo" && test -e F @@ -33,4 +39,17 @@ test_expect_success SHA1 'loose object cache vs re-reading todo list' ' git rebase HEAD -x "./append-todo.sh 5 6" ' +test_expect_success 'todo is re-read after reword and squash' ' + write_script reword-editor.sh <<-\EOS && + GIT_SEQUENCE_EDITOR="echo \"exec echo $(cat file) >>actual\" >>" \ + git rebase --edit-todo + EOS + + test_write_lines first third >expected && + set_fake_editor && + GIT_SEQUENCE_EDITOR="$EDITOR" FAKE_LINES="reword 1 squash 2 fixup 3" \ + GIT_EDITOR=./reword-editor.sh git rebase -i --root third && + test_cmp expected actual +' + test_done |