Use shorter error messages for whitespace problems
[git/git-p4.git] / t / t3502-cherry-pick-merge.sh
blob7c92e261fcc87adc1a00c1832284816e40dee55d
1 #!/bin/sh
3 test_description='cherry picking and reverting a merge
5 b---c
6 / /
7 initial---a
11 . ./test-lib.sh
13 test_expect_success setup '
15 >A &&
16 >B &&
17 git add A B &&
18 git commit -m "Initial" &&
19 git tag initial &&
20 git branch side &&
21 echo new line >A &&
22 git commit -m "add line to A" A &&
23 git tag a &&
24 git checkout side &&
25 echo new line >B &&
26 git commit -m "add line to B" B &&
27 git tag b &&
28 git checkout master &&
29 git merge side &&
30 git tag c
34 test_expect_success 'cherry-pick a non-merge with -m should fail' '
36 git reset --hard &&
37 git checkout a^0 &&
38 ! git cherry-pick -m 1 b &&
39 git diff --exit-code a --
43 test_expect_success 'cherry pick a merge without -m should fail' '
45 git reset --hard &&
46 git checkout a^0 &&
47 ! git cherry-pick c &&
48 git diff --exit-code a --
52 test_expect_success 'cherry pick a merge (1)' '
54 git reset --hard &&
55 git checkout a^0 &&
56 git cherry-pick -m 1 c &&
57 git diff --exit-code c
61 test_expect_success 'cherry pick a merge (2)' '
63 git reset --hard &&
64 git checkout b^0 &&
65 git cherry-pick -m 2 c &&
66 git diff --exit-code c
70 test_expect_success 'cherry pick a merge relative to nonexistent parent should fail' '
72 git reset --hard &&
73 git checkout b^0 &&
74 ! git cherry-pick -m 3 c
78 test_expect_success 'revert a non-merge with -m should fail' '
80 git reset --hard &&
81 git checkout c^0 &&
82 ! git revert -m 1 b &&
83 git diff --exit-code c
87 test_expect_success 'revert a merge without -m should fail' '
89 git reset --hard &&
90 git checkout c^0 &&
91 ! git revert c &&
92 git diff --exit-code c
96 test_expect_success 'revert a merge (1)' '
98 git reset --hard &&
99 git checkout c^0 &&
100 git revert -m 1 c &&
101 git diff --exit-code a --
105 test_expect_success 'revert a merge (2)' '
107 git reset --hard &&
108 git checkout c^0 &&
109 git revert -m 2 c &&
110 git diff --exit-code b --
114 test_expect_success 'revert a merge relative to nonexistent parent should fail' '
116 git reset --hard &&
117 git checkout c^0 &&
118 ! git revert -m 3 c &&
119 git diff --exit-code c
123 test_done