Build in ls-remote
[alt-git.git] / t / t6007-rev-list-cherry-pick-file.sh
blob4b8611ce2092f9062aeaeb62ce19a9121d5be537
1 #!/bin/sh
3 test_description='test git rev-list --cherry-pick -- file'
5 . ./test-lib.sh
7 # A---B
8 # \
9 # \
10 # C
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 '
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
35 test_expect_success '--cherry-pick foo comes up empty' '
36 test -z "$(git rev-list --left-right --cherry-pick B...C -- foo)"
39 test_expect_success '--cherry-pick bar does not come up empty' '
40 ! test -z "$(git rev-list --left-right --cherry-pick B...C -- bar)"
43 test_expect_success '--cherry-pick with independent, but identical branches' '
44 git symbolic-ref HEAD refs/heads/independent &&
45 rm .git/index &&
46 echo Hallo > foo &&
47 git add foo &&
48 test_tick &&
49 git commit -m "independent" &&
50 echo Bello > foo &&
51 test_tick &&
52 git commit -m "independent, too" foo &&
53 test -z "$(git rev-list --left-right --cherry-pick \
54 HEAD...master -- foo)"
57 test_done