3 test_description='--ancestry-path'
7 # B---C---G---H---I---J
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
15 # --ancestry-path D..M -- M.t == M
18 # --ancestry-path F...I == F H I
20 # G..M -- G.t == [nothing - was dropped in "-s ours" merge L]
21 # --ancestry-path G..M -- G.t == H J L
27 git merge -s ours -m "$2" "$1" &&
31 test_expect_success setup '
49 test_expect_success 'rev-list D..M' '
50 for c in E F G H I J K L M; do echo $c; done >expect &&
51 git rev-list --format=%s D..M |
52 sed -e "/^commit /d" |
54 test_cmp expect actual
57 test_expect_success 'rev-list --ancestry-path D..M' '
58 for c in E F H I J L M; do echo $c; done >expect &&
59 git rev-list --ancestry-path --format=%s D..M |
60 sed -e "/^commit /d" |
62 test_cmp expect actual
65 test_expect_success 'rev-list D..M -- M.t' '
67 git rev-list --format=%s D..M -- M.t |
68 sed -e "/^commit /d" >actual &&
69 test_cmp expect actual
72 test_expect_success 'rev-list --ancestry-path D..M -- M.t' '
74 git rev-list --ancestry-path --format=%s D..M -- M.t |
75 sed -e "/^commit /d" >actual &&
76 test_cmp expect actual
79 test_expect_success 'rev-list F...I' '
80 for c in F G H I; do echo $c; done >expect &&
81 git rev-list --format=%s F...I |
82 sed -e "/^commit /d" |
84 test_cmp expect actual
87 test_expect_success 'rev-list --ancestry-path F...I' '
88 for c in F H I; do echo $c; done >expect &&
89 git rev-list --ancestry-path --format=%s F...I |
90 sed -e "/^commit /d" |
92 test_cmp expect actual
95 # G.t is dropped in an "-s ours" merge
96 test_expect_success 'rev-list G..M -- G.t' '
98 git rev-list --format=%s G..M -- G.t |
99 sed -e "/^commit /d" >actual &&
100 test_cmp expect actual
103 test_expect_success 'rev-list --ancestry-path G..M -- G.t' '
104 for c in H J L; do echo $c; done >expect &&
105 git rev-list --ancestry-path --format=%s G..M -- G.t |
106 sed -e "/^commit /d" |
108 test_cmp expect actual
117 # All refnames prefixed with 'x' to avoid confusion with the tags
118 # generated by test_commit on case-insensitive systems.
119 test_expect_success 'setup criss-cross' '
124 git checkout -b xb master &&
126 git checkout -b xc master &&
128 git checkout -b xbc xb -- &&
130 git checkout -b xcb xc -- &&
135 # no commits in bc descend from cb
136 test_expect_success 'criss-cross: rev-list --ancestry-path cb..bc' '
138 git rev-list --ancestry-path xcb..xbc > actual &&
139 test -z "$(cat actual)")
142 # no commits in repository descend from cb
143 test_expect_success 'criss-cross: rev-list --ancestry-path --all ^cb' '
145 git rev-list --ancestry-path --all ^xcb > actual &&
146 test -z "$(cat actual)")