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 differently.
16 test_expect_success setup
'
22 git checkout -b branch &&
34 git checkout master &&
35 git checkout branch foo &&
51 test_expect_success
'--left-right' '
52 git rev-list --left-right B...C > actual &&
53 git name-rev --stdin --name-only --refs="*tags/*" \
54 < actual > actual.named &&
55 test_cmp actual.named expect
58 test_expect_success
'--count' '
59 git rev-list --count B...C > actual &&
60 test "$(cat actual)" = 2
63 test_expect_success
'--cherry-pick foo comes up empty' '
64 test -z "$(git rev-list --left-right --cherry-pick B...C -- foo)"
71 test_expect_success
'--cherry-pick bar does not come up empty' '
72 git rev-list --left-right --cherry-pick B...C -- bar > actual &&
73 git name-rev --stdin --name-only --refs="*tags/*" \
74 < actual > actual.named &&
75 test_cmp actual.named expect
78 test_expect_success
'bar does not come up empty' '
79 git rev-list --left-right B...C -- bar > actual &&
80 git name-rev --stdin --name-only --refs="*tags/*" \
81 < actual > actual.named &&
82 test_cmp actual.named expect
89 test_expect_success
'--cherry-pick bar does not come up empty (II)' '
90 git rev-list --left-right --cherry-pick D...E -- bar > actual &&
91 git name-rev --stdin --name-only --refs="*tags/*" \
92 < actual > actual.named &&
93 test_cmp actual.named expect
96 test_expect_success
'--cherry-pick with independent, but identical branches' '
97 git symbolic-ref HEAD refs/heads/independent &&
102 git commit -m "independent" &&
105 git commit -m "independent, too" foo &&
106 test -z "$(git rev-list --left-right --cherry-pick \
107 HEAD...master -- foo)"
114 test_expect_success
'--count --left-right' '
115 git rev-list --count --left-right C...D > actual &&
116 test_cmp expect actual