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.
15 test_expect_success setup
'
21 git checkout -b branch &&
28 git checkout master &&
29 git checkout branch foo &&
40 test_expect_success
'--left-right' '
41 git rev-list --left-right B...C > actual &&
42 git name-rev --stdin --name-only --refs="*tags/*" \
43 < actual > actual.named &&
44 test_cmp actual.named expect
47 test_expect_success
'--count' '
48 git rev-list --count B...C > actual &&
49 test "$(cat actual)" = 2
52 test_expect_success
'--cherry-pick foo comes up empty' '
53 test -z "$(git rev-list --left-right --cherry-pick B...C -- foo)"
56 test_expect_success
'--cherry-pick bar does not come up empty' '
57 ! test -z "$(git rev-list --left-right --cherry-pick B...C -- bar)"
60 test_expect_success
'--cherry-pick with independent, but identical branches' '
61 git symbolic-ref HEAD refs/heads/independent &&
66 git commit -m "independent" &&
69 git commit -m "independent, too" foo &&
70 test -z "$(git rev-list --left-right --cherry-pick \
71 HEAD...master -- foo)"
78 # Insert an extra commit to break the symmetry
79 test_expect_success
'--count --left-right' '
80 git checkout branch &&
82 git rev-list --count --left-right B...D > actual &&
83 test_cmp expect actual