Merge branch 'master' of git://repo.or.cz/alt-git
[git/mingw.git] / t / t7106-reset-sequence.sh
blob4956caaf82be8c42ef01a9adae55387e87adaa04
1 #!/bin/sh
3 test_description='Test interaction of reset --hard with sequencer
5 + anotherpick: rewrites foo to d
6 + picked: rewrites foo to c
7 + unrelatedpick: rewrites unrelated to reallyunrelated
8 + base: rewrites foo to b
9 + initial: writes foo as a, unrelated as unrelated
12 . ./test-lib.sh
14 pristine_detach () {
15 git cherry-pick --reset &&
16 git checkout -f "$1^0" &&
17 git read-tree -u --reset HEAD &&
18 git clean -d -f -f -q -x
21 test_expect_success setup '
22 echo unrelated >unrelated &&
23 git add unrelated &&
24 test_commit initial foo a &&
25 test_commit base foo b &&
26 test_commit unrelatedpick unrelated reallyunrelated &&
27 test_commit picked foo c &&
28 test_commit anotherpick foo d &&
29 git config advice.detachedhead false
33 test_expect_success 'reset --hard cleans up sequencer state, providing one-level undo' '
34 pristine_detach initial &&
35 test_must_fail git cherry-pick base..anotherpick &&
36 test_path_is_dir .git/sequencer &&
37 git reset --hard &&
38 test_path_is_missing .git/sequencer &&
39 test_path_is_dir .git/sequencer-old &&
40 git reset --hard &&
41 test_path_is_missing .git/sequencer-old
44 test_done