revision.c: treat A...B merge bases as if manually specified
[git/jrn.git] / t / t6019-rev-list-ancestry-path.sh
blobdd5b0e55d26b0f9258ae47425050083abe385fc0
1 #!/bin/sh
3 test_description='--ancestry-path'
5 # D---E-------F
6 # / \ \
7 # B---C---G---H---I---J
8 # / \
9 # A-------K---------------L--M
11 # D..M == E F G H I J K L M
12 # --ancestry-path D..M == E F H I J L M
14 # D..M -- M.t == M
15 # --ancestry-path D..M -- M.t == M
17 # F...I == F G H I
18 # --ancestry-path F...I == F H I
20 . ./test-lib.sh
22 test_merge () {
23 test_tick &&
24 git merge -s ours -m "$2" "$1" &&
25 git tag "$2"
28 test_expect_success setup '
29 test_commit A &&
30 test_commit B &&
31 test_commit C &&
32 test_commit D &&
33 test_commit E &&
34 test_commit F &&
35 git reset --hard C &&
36 test_commit G &&
37 test_merge E H &&
38 test_commit I &&
39 test_merge F J &&
40 git reset --hard A &&
41 test_commit K &&
42 test_merge J L &&
43 test_commit M
46 test_expect_success 'rev-list D..M' '
47 for c in E F G H I J K L M; do echo $c; done >expect &&
48 git rev-list --format=%s D..M |
49 sed -e "/^commit /d" |
50 sort >actual &&
51 test_cmp expect actual
54 test_expect_success 'rev-list --ancestry-path D..M' '
55 for c in E F H I J L M; do echo $c; done >expect &&
56 git rev-list --ancestry-path --format=%s D..M |
57 sed -e "/^commit /d" |
58 sort >actual &&
59 test_cmp expect actual
62 test_expect_success 'rev-list D..M -- M.t' '
63 echo M >expect &&
64 git rev-list --format=%s D..M -- M.t |
65 sed -e "/^commit /d" >actual &&
66 test_cmp expect actual
69 test_expect_success 'rev-list --ancestry-path D..M -- M.t' '
70 echo M >expect &&
71 git rev-list --ancestry-path --format=%s D..M -- M.t |
72 sed -e "/^commit /d" >actual &&
73 test_cmp expect actual
76 test_expect_success 'rev-list F...I' '
77 for c in F G H I; do echo $c; done >expect &&
78 git rev-list --format=%s F...I |
79 sed -e "/^commit /d" |
80 sort >actual &&
81 test_cmp expect actual
84 test_expect_success 'rev-list --ancestry-path F...I' '
85 for c in F H I; do echo $c; done >expect &&
86 git rev-list --ancestry-path --format=%s F...I |
87 sed -e "/^commit /d" |
88 sort >actual &&
89 test_cmp expect actual
92 # b---bc
93 # / \ /
94 # a X
95 # \ / \
96 # c---cb
98 # All refnames prefixed with 'x' to avoid confusion with the tags
99 # generated by test_commit on case-insensitive systems.
100 test_expect_success 'setup criss-cross' '
101 mkdir criss-cross &&
102 (cd criss-cross &&
103 git init &&
104 test_commit A &&
105 git checkout -b xb master &&
106 test_commit B &&
107 git checkout -b xc master &&
108 test_commit C &&
109 git checkout -b xbc xb -- &&
110 git merge xc &&
111 git checkout -b xcb xc -- &&
112 git merge xb &&
113 git checkout master)
116 # no commits in bc descend from cb
117 test_expect_success 'criss-cross: rev-list --ancestry-path cb..bc' '
118 (cd criss-cross &&
119 git rev-list --ancestry-path xcb..xbc > actual &&
120 test -z "$(cat actual)")
123 # no commits in repository descend from cb
124 test_expect_success 'criss-cross: rev-list --ancestry-path --all ^cb' '
125 (cd criss-cross &&
126 git rev-list --ancestry-path --all ^xcb > actual &&
127 test -z "$(cat actual)")
130 test_done