summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-05-13 14:50:35 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-05-13 14:50:35 (GMT)
commitb51a0fdc3822c2ef260f6d496b6df6d33b101e8a (patch)
tree62b916b74af5ee6f51b6e924d9d7a65311085420 /t
parent7ba06bc3d026cee54437db5cfddfffe7b4d7a187 (diff)
parent4a72486de97b5c6b0979b2b51e50c268bdb0d4f6 (diff)
downloadgit-b51a0fdc3822c2ef260f6d496b6df6d33b101e8a.zip
git-b51a0fdc3822c2ef260f6d496b6df6d33b101e8a.tar.gz
git-b51a0fdc3822c2ef260f6d496b6df6d33b101e8a.tar.bz2
Merge branch 'pw/clean-sequencer-state-upon-final-commit'
"git chery-pick" (and "revert" that shares the same runtime engine) that deals with multiple commits got confused when the final step gets stopped with a conflict and the user concluded the sequence with "git commit". Attempt to fix it by cleaning up the state files used by these commands in such a situation. * pw/clean-sequencer-state-upon-final-commit: fix cherry-pick/revert status after commit commit/reset: try to clean up sequencer state
Diffstat (limited to 't')
-rwxr-xr-xt/t3507-cherry-pick-conflict.sh39
-rwxr-xr-xt/t7512-status-help.sh36
2 files changed, 75 insertions, 0 deletions
diff --git a/t/t3507-cherry-pick-conflict.sh b/t/t3507-cherry-pick-conflict.sh
index 1a8818f..9b9b4ca 100755
--- a/t/t3507-cherry-pick-conflict.sh
+++ b/t/t3507-cherry-pick-conflict.sh
@@ -161,6 +161,25 @@ test_expect_success 'successful commit clears CHERRY_PICK_HEAD' '
test_must_fail git rev-parse --verify CHERRY_PICK_HEAD
'
+test_expect_success 'successful final commit clears cherry-pick state' '
+ pristine_detach initial &&
+
+ test_must_fail git cherry-pick base picked-signed &&
+ echo resolved >foo &&
+ test_path_is_file .git/sequencer/todo &&
+ git commit -a &&
+ test_must_fail test_path_exists .git/sequencer
+'
+
+test_expect_success 'reset after final pick clears cherry-pick state' '
+ pristine_detach initial &&
+
+ test_must_fail git cherry-pick base picked-signed &&
+ echo resolved >foo &&
+ test_path_is_file .git/sequencer/todo &&
+ git reset &&
+ test_must_fail test_path_exists .git/sequencer
+'
test_expect_success 'failed cherry-pick produces dirty index' '
pristine_detach initial &&
@@ -361,6 +380,26 @@ test_expect_success 'failed commit does not clear REVERT_HEAD' '
test_cmp_rev picked REVERT_HEAD
'
+test_expect_success 'successful final commit clears revert state' '
+ pristine_detach picked-signed &&
+
+ test_must_fail git revert picked-signed base &&
+ echo resolved >foo &&
+ test_path_is_file .git/sequencer/todo &&
+ git commit -a &&
+ test_must_fail test_path_exists .git/sequencer
+'
+
+test_expect_success 'reset after final pick clears revert state' '
+ pristine_detach picked-signed &&
+
+ test_must_fail git revert picked-signed base &&
+ echo resolved >foo &&
+ test_path_is_file .git/sequencer/todo &&
+ git reset &&
+ test_must_fail test_path_exists .git/sequencer
+'
+
test_expect_success 'revert conflict, diff3 -m style' '
pristine_detach initial &&
git config merge.conflictstyle diff3 &&
diff --git a/t/t7512-status-help.sh b/t/t7512-status-help.sh
index 458608c..c1eb725 100755
--- a/t/t7512-status-help.sh
+++ b/t/t7512-status-help.sh
@@ -780,6 +780,24 @@ EOF
test_i18ncmp expected actual
'
+test_expect_success 'status when cherry-picking after committing conflict resolution' '
+ git reset --hard cherry_branch &&
+ test_when_finished "git cherry-pick --abort" &&
+ test_must_fail git cherry-pick cherry_branch_second one_cherry &&
+ echo end >main.txt &&
+ git commit -a &&
+ cat >expected <<EOF &&
+On branch cherry_branch
+Cherry-pick currently in progress.
+ (run "git cherry-pick --continue" to continue)
+ (use "git cherry-pick --abort" to cancel the cherry-pick operation)
+
+nothing to commit (use -u to show untracked files)
+EOF
+ git status --untracked-files=no >actual &&
+ test_i18ncmp expected actual
+'
+
test_expect_success 'status showing detached at and from a tag' '
test_commit atag tagging &&
git checkout atag &&
@@ -857,6 +875,24 @@ EOF
test_i18ncmp expected actual
'
+test_expect_success 'status while reverting after committing conflict resolution' '
+ test_when_finished "git revert --abort" &&
+ git reset --hard new &&
+ test_must_fail git revert old new &&
+ echo reverted >to-revert.txt &&
+ git commit -a &&
+ cat >expected <<EOF &&
+On branch master
+Revert currently in progress.
+ (run "git revert --continue" to continue)
+ (use "git revert --abort" to cancel the revert operation)
+
+nothing to commit (use -u to show untracked files)
+EOF
+ git status --untracked-files=no >actual &&
+ test_i18ncmp expected actual
+'
+
test_expect_success 'prepare for different number of commits rebased' '
git reset --hard master &&
git checkout -b several_commits &&