1#!/bin/sh
2
3test_description='test git rev-list --cherry-pick -- file'
4
5. ./test-lib.sh
6
7# A---B
8# \
9# \
10# C
11#
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
15test_expect_success setup '
16 echo Hallo > foo &&
17 git add foo &&
18 test_tick &&
19 git commit -m "A" &&
20 git tag A &&
21 git checkout -b branch &&
22 echo Bello > foo &&
23 echo Cello > bar &&
24 git add foo bar &&
25 test_tick &&
26 git commit -m "C" &&
27 git tag C &&
28 git checkout master &&
29 git checkout branch foo &&
30 test_tick &&
31 git commit -m "B" &&
32 git tag B
33'
34
35test_expect_success '--cherry-pick foo comes up empty' '
36 test -z "$(git rev-list --left-right --cherry-pick B...C -- foo)"
37'
38
39test_expect_success '--cherry-pick bar does not come up empty' '
40 ! test -z "$(git rev-list --left-right --cherry-pick B...C -- bar)"
41'
42
43test_done