packfile.c: fix a typo in `each_file_in_pack_dir_fn()`'s declaration
[alt-git.git] / t / t3504-cherry-pick-rerere.sh
blob4581ae98b87cf1f05d018cfc07599e8e26d256da
1 #!/bin/sh
3 test_description='cherry-pick should rerere for conflicts'
5 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
8 . ./test-lib.sh
10 test_expect_success setup '
11 test_commit foo &&
12 test_commit foo-main foo &&
13 test_commit bar-main bar &&
15 git checkout -b dev foo &&
16 test_commit foo-dev foo &&
17 test_commit bar-dev bar &&
18 git config rerere.enabled true
21 test_expect_success 'conflicting merge' '
22 test_must_fail git merge main
25 test_expect_success 'fixup' '
26 echo foo-resolved >foo &&
27 echo bar-resolved >bar &&
28 git commit -am resolved &&
29 cp foo foo-expect &&
30 cp bar bar-expect &&
31 git reset --hard HEAD^
34 test_expect_success 'cherry-pick conflict with --rerere-autoupdate' '
35 test_must_fail git cherry-pick --rerere-autoupdate foo..bar-main &&
36 test_cmp foo-expect foo &&
37 git diff-files --quiet &&
38 test_must_fail git cherry-pick --continue &&
39 test_cmp bar-expect bar &&
40 git diff-files --quiet &&
41 git cherry-pick --continue &&
42 git reset --hard bar-dev
45 test_expect_success 'cherry-pick conflict repsects rerere.autoUpdate' '
46 test_config rerere.autoUpdate true &&
47 test_must_fail git cherry-pick foo..bar-main &&
48 test_cmp foo-expect foo &&
49 git diff-files --quiet &&
50 test_must_fail git cherry-pick --continue &&
51 test_cmp bar-expect bar &&
52 git diff-files --quiet &&
53 git cherry-pick --continue &&
54 git reset --hard bar-dev
57 test_expect_success 'cherry-pick conflict with --no-rerere-autoupdate' '
58 test_config rerere.autoUpdate true &&
59 test_must_fail git cherry-pick --no-rerere-autoupdate foo..bar-main &&
60 test_cmp foo-expect foo &&
61 test_must_fail git diff-files --quiet &&
62 git add foo &&
63 test_must_fail git cherry-pick --continue &&
64 test_cmp bar-expect bar &&
65 test_must_fail git diff-files --quiet &&
66 git add bar &&
67 git cherry-pick --continue &&
68 git reset --hard bar-dev
71 test_expect_success 'cherry-pick --continue rejects --rerere-autoupdate' '
72 test_must_fail git cherry-pick --rerere-autoupdate foo..bar-main &&
73 test_cmp foo-expect foo &&
74 git diff-files --quiet &&
75 test_must_fail git cherry-pick --continue --rerere-autoupdate >actual 2>&1 &&
76 echo "fatal: cherry-pick: --rerere-autoupdate cannot be used with --continue" >expect &&
77 test_cmp expect actual &&
78 test_must_fail git cherry-pick --continue --no-rerere-autoupdate >actual 2>&1 &&
79 echo "fatal: cherry-pick: --no-rerere-autoupdate cannot be used with --continue" >expect &&
80 test_cmp expect actual &&
81 git cherry-pick --abort
84 test_expect_success 'cherry-pick --rerere-autoupdate more than once' '
85 test_must_fail git cherry-pick --rerere-autoupdate --rerere-autoupdate foo..bar-main &&
86 test_cmp foo-expect foo &&
87 git diff-files --quiet &&
88 git cherry-pick --abort &&
89 test_must_fail git cherry-pick --rerere-autoupdate --no-rerere-autoupdate --rerere-autoupdate foo..bar-main &&
90 test_cmp foo-expect foo &&
91 git diff-files --quiet &&
92 git cherry-pick --abort &&
93 test_must_fail git cherry-pick --rerere-autoupdate --no-rerere-autoupdate foo..bar-main &&
94 test_must_fail git diff-files --quiet &&
95 git cherry-pick --abort
98 test_expect_success 'cherry-pick conflict without rerere' '
99 test_config rerere.enabled false &&
100 test_must_fail git cherry-pick foo-main &&
101 grep ===== foo &&
102 grep foo-dev foo &&
103 grep foo-main foo
106 test_done