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 == L
22 # --ancestry-path --simplify-merges G^..M -- G.t == G L
28 git merge -s ours -m "$2" "$1" &&
32 test_expect_success setup '
50 test_expect_success 'rev-list D..M' '
51 for c in E F G H I J K L M; do echo $c; done >expect &&
52 git rev-list --format=%s D..M |
53 sed -e "/^commit /d" |
55 test_cmp expect actual
58 test_expect_success 'rev-list --ancestry-path D..M' '
59 for c in E F H I J L M; do echo $c; done >expect &&
60 git rev-list --ancestry-path --format=%s D..M |
61 sed -e "/^commit /d" |
63 test_cmp expect actual
66 test_expect_success 'rev-list D..M -- M.t' '
68 git rev-list --format=%s D..M -- M.t |
69 sed -e "/^commit /d" >actual &&
70 test_cmp expect actual
73 test_expect_success 'rev-list --ancestry-path D..M -- M.t' '
75 git rev-list --ancestry-path --format=%s D..M -- M.t |
76 sed -e "/^commit /d" >actual &&
77 test_cmp expect actual
80 test_expect_success 'rev-list F...I' '
81 for c in F G H I; do echo $c; done >expect &&
82 git rev-list --format=%s F...I |
83 sed -e "/^commit /d" |
85 test_cmp expect actual
88 test_expect_success 'rev-list --ancestry-path F...I' '
89 for c in F H I; do echo $c; done >expect &&
90 git rev-list --ancestry-path --format=%s F...I |
91 sed -e "/^commit /d" |
93 test_cmp expect actual
96 # G.t is dropped in an "-s ours" merge
97 test_expect_success 'rev-list G..M -- G.t' '
99 git rev-list --format=%s G..M -- G.t |
100 sed -e "/^commit /d" >actual &&
101 test_cmp expect actual
104 test_expect_success 'rev-list --ancestry-path G..M -- G.t' '
106 git rev-list --ancestry-path --format=%s G..M -- G.t |
107 sed -e "/^commit /d" >actual &&
108 test_cmp expect actual
111 test_expect_success 'rev-list --ancestry-path --simplify-merges G^..M -- G.t' '
112 for c in G L; do echo $c; done >expect &&
113 git rev-list --ancestry-path --simplify-merges --format=%s G^..M -- G.t |
114 sed -e "/^commit /d" |
116 test_cmp expect actual
125 # All refnames prefixed with 'x' to avoid confusion with the tags
126 # generated by test_commit on case-insensitive systems.
127 test_expect_success 'setup criss-cross' '
132 git checkout -b xb master &&
134 git checkout -b xc master &&
136 git checkout -b xbc xb -- &&
138 git checkout -b xcb xc -- &&
143 # no commits in bc descend from cb
144 test_expect_success 'criss-cross: rev-list --ancestry-path cb..bc' '
146 git rev-list --ancestry-path xcb..xbc > actual &&
147 test -z "$(cat actual)")
150 # no commits in repository descend from cb
151 test_expect_success 'criss-cross: rev-list --ancestry-path --all ^cb' '
153 git rev-list --ancestry-path --all ^xcb > actual &&
154 test -z "$(cat actual)")