diff options
author | Phillip Wood <phillip.wood@dunelm.org.uk> | 2017-08-02 13:44:19 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-08-03 01:16:09 +0300 |
commit | 8d8cb4b047cef546ea80b8224c7b33707f6d6a4c (patch) | |
tree | 1f322b953e16e9fc879560a0fc81c67b81042ba0 /t/t3504-cherry-pick-rerere.sh | |
parent | 6f0e577e46619a15baefc48192abee34451effa5 (diff) |
cherry-pick/revert: remember --rerere-autoupdate
When continuing after conflicts, cherry-pick forgot if the user had specified
'--rerere-autoupdate'.
Redo the cherry-pick rerere tests to check --rerere-autoupdate works
as expected.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3504-cherry-pick-rerere.sh')
-rwxr-xr-x | t/t3504-cherry-pick-rerere.sh | 60 |
1 files changed, 53 insertions, 7 deletions
diff --git a/t/t3504-cherry-pick-rerere.sh b/t/t3504-cherry-pick-rerere.sh index 33f902b1b0..af316cb40b 100755 --- a/t/t3504-cherry-pick-rerere.sh +++ b/t/t3504-cherry-pick-rerere.sh @@ -7,9 +7,11 @@ test_description='cherry-pick should rerere for conflicts' test_expect_success setup ' test_commit foo && test_commit foo-master foo && + test_commit bar-master bar && git checkout -b dev foo && test_commit foo-dev foo && + test_commit bar-dev bar && git config rerere.enabled true ' @@ -19,22 +21,66 @@ test_expect_success 'conflicting merge' ' test_expect_success 'fixup' ' echo foo-resolved >foo && + echo bar-resolved >bar && git commit -am resolved && - cp foo expect && + cp foo foo-expect && + cp bar bar-expect && git reset --hard HEAD^ ' -test_expect_success 'cherry-pick conflict' ' - test_must_fail git cherry-pick master && - test_cmp expect foo +test_expect_success 'cherry-pick conflict with --rerere-autoupdate' ' + test_must_fail git cherry-pick --rerere-autoupdate foo..bar-master && + test_cmp foo-expect foo && + git diff-files --quiet && + test_must_fail git cherry-pick --continue && + test_cmp bar-expect bar && + git diff-files --quiet && + git cherry-pick --continue && + git reset --hard bar-dev +' + +test_expect_success 'cherry-pick conflict repsects rerere.autoUpdate' ' + test_config rerere.autoUpdate true && + test_must_fail git cherry-pick foo..bar-master && + test_cmp foo-expect foo && + git diff-files --quiet && + test_must_fail git cherry-pick --continue && + test_cmp bar-expect bar && + git diff-files --quiet && + git cherry-pick --continue && + git reset --hard bar-dev +' + +test_expect_success 'cherry-pick conflict with --no-rerere-autoupdate' ' + test_config rerere.autoUpdate true && + test_must_fail git cherry-pick --no-rerere-autoupdate foo..bar-master && + test_cmp foo-expect foo && + test_must_fail git diff-files --quiet && + git add foo && + test_must_fail git cherry-pick --continue && + test_cmp bar-expect bar && + test_must_fail git diff-files --quiet && + git add bar && + git cherry-pick --continue && + git reset --hard bar-dev ' -test_expect_success 'reconfigure' ' - git config rerere.enabled false && - git reset --hard +test_expect_success 'cherry-pick --rerere-autoupdate more than once' ' + test_must_fail git cherry-pick --rerere-autoupdate --rerere-autoupdate foo..bar-master && + test_cmp foo-expect foo && + git diff-files --quiet && + git cherry-pick --abort && + test_must_fail git cherry-pick --rerere-autoupdate --no-rerere-autoupdate --rerere-autoupdate foo..bar-master && + test_cmp foo-expect foo && + git diff-files --quiet && + git cherry-pick --abort && + test_must_fail git cherry-pick --rerere-autoupdate --no-rerere-autoupdate foo..bar-master && + test_must_fail git diff-files --quiet && + git cherry-pick --abort ' test_expect_success 'cherry-pick conflict without rerere' ' + test_config rerere.enabled false && test_must_fail git cherry-pick master && test_must_fail test_cmp expect foo ' |