3 test_description
='test git rev-list --cherry-pick -- file'
12 # B changes a file foo.c, adding a line of text. C changes foo.c as
13 # well as bar.c, but the change in foo.c was identical to change B.
14 # D and C change bar in the same way, E and F differently.
16 test_expect_success setup
'
22 git checkout -b branch &&
34 git checkout master &&
35 git checkout branch foo &&
56 test_expect_success
'--left-right' '
57 git rev-list --left-right B...C > actual &&
58 git name-rev --stdin --name-only --refs="*tags/*" \
59 < actual > actual.named &&
60 test_cmp actual.named expect
63 test_expect_success
'--count' '
64 git rev-list --count B...C > actual &&
65 test "$(cat actual)" = 2
68 test_expect_success
'--cherry-pick foo comes up empty' '
69 test -z "$(git rev-list --left-right --cherry-pick B...C -- foo)"
76 test_expect_success
'--cherry-pick bar does not come up empty' '
77 git rev-list --left-right --cherry-pick B...C -- bar > actual &&
78 git name-rev --stdin --name-only --refs="*tags/*" \
79 < actual > actual.named &&
80 test_cmp actual.named expect
83 test_expect_success
'bar does not come up empty' '
84 git rev-list --left-right B...C -- bar > actual &&
85 git name-rev --stdin --name-only --refs="*tags/*" \
86 < actual > actual.named &&
87 test_cmp actual.named expect
95 test_expect_success
'--cherry-pick bar does not come up empty (II)' '
96 git rev-list --left-right --cherry-pick F...E -- bar > actual &&
97 git name-rev --stdin --name-only --refs="*tags/*" \
98 < actual > actual.named &&
99 test_cmp actual.named expect
109 test_expect_success
'--cherry-mark' '
110 git rev-list --cherry-mark F...E -- bar > actual &&
111 git name-rev --stdin --name-only --refs="*tags/*" \
112 < actual > actual.named &&
113 test_cmp actual.named expect
123 test_expect_success
'--cherry-mark --left-right' '
124 git rev-list --cherry-mark --left-right F...E -- bar > actual &&
125 git name-rev --stdin --name-only --refs="*tags/*" \
126 < actual > actual.named &&
127 test_cmp actual.named expect
134 test_expect_success
'--cherry-pick --right-only' '
135 git rev-list --cherry-pick --right-only F...E -- bar > actual &&
136 git name-rev --stdin --name-only --refs="*tags/*" \
137 < actual > actual.named &&
138 test_cmp actual.named expect
141 test_expect_success
'--cherry-pick --left-only' '
142 git rev-list --cherry-pick --left-only E...F -- bar > actual &&
143 git name-rev --stdin --name-only --refs="*tags/*" \
144 < actual > actual.named &&
145 test_cmp actual.named expect
153 test_expect_success
'--cherry' '
154 git rev-list --cherry F...E -- bar > actual &&
155 git name-rev --stdin --name-only --refs="*tags/*" \
156 < actual > actual.named &&
157 test_cmp actual.named expect
164 test_expect_success
'--cherry --count' '
165 git rev-list --cherry --count F...E -- bar > actual &&
166 test_cmp actual expect
173 test_expect_success
'--cherry-mark --count' '
174 git rev-list --cherry-mark --count F...E -- bar > actual &&
175 test_cmp actual expect
182 test_expect_success
'--cherry-mark --left-right --count' '
183 git rev-list --cherry-mark --left-right --count F...E -- bar > actual &&
184 test_cmp actual expect
187 test_expect_success
'--cherry-pick with independent, but identical branches' '
188 git symbolic-ref HEAD refs/heads/independent &&
193 git commit -m "independent" &&
196 git commit -m "independent, too" foo &&
197 test -z "$(git rev-list --left-right --cherry-pick \
198 HEAD...master -- foo)"
205 test_expect_success
'--count --left-right' '
206 git rev-list --count --left-right C...D > actual &&
207 test_cmp expect actual