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
13 # --ancestry-path=F D..M == E F J L M
14 # --ancestry-path=G D..M == G H I J L M
15 # --ancestry-path=H D..M == E G H I J L M
16 # --ancestry-path=K D..M == K L M
17 # --ancestry-path=K --ancestry-path=F D..M == E F J K L M
20 # --ancestry-path D..M -- M.t == M
23 # --ancestry-path F...I == F H I
25 # G..M -- G.t == [nothing - was dropped in "-s ours" merge L]
26 # --ancestry-path G..M -- G.t == L
27 # --ancestry-path --simplify-merges G^..M -- G.t == G L
29 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
=main
30 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
36 git merge
-s ours
-m "$2" "$1" &&
40 test_expect_success setup
'
61 test_expect_success
"log $args" "
62 test_write_lines $expected >expect &&
63 git log --format=%s $args >raw &&
65 if test -n \"$expected\"
68 test_cmp expect actual
70 test_must_be_empty raw
75 test_ancestry
"D..M" "E F G H I J K L M"
77 test_ancestry
"--ancestry-path D..M" "E F H I J L M"
78 test_ancestry
"--ancestry-path=F D..M" "E F J L M"
79 test_ancestry
"--ancestry-path=G D..M" "G H I J L M"
80 test_ancestry
"--ancestry-path=H D..M" "E G H I J L M"
81 test_ancestry
"--ancestry-path=K D..M" "K L M"
82 test_ancestry
"--ancestry-path=F --ancestry-path=K D..M" "E F J K L M"
84 test_ancestry
"D..M -- M.t" "M"
85 test_ancestry
"--ancestry-path D..M -- M.t" "M"
87 test_ancestry
"F...I" "F G H I"
88 test_ancestry
"--ancestry-path F...I" "F H I"
90 test_ancestry
"G..M -- G.t" ""
91 test_ancestry
"--ancestry-path G..M -- G.t" "L"
92 test_ancestry
"--ancestry-path --simplify-merges G^..M -- G.t" "G L"
100 # All refnames prefixed with 'x' to avoid confusion with the tags
101 # generated by test_commit on case-insensitive systems.
102 test_expect_success
'setup criss-cross' '
107 git checkout -b xb main &&
109 git checkout -b xc main &&
111 git checkout -b xbc xb -- &&
113 git checkout -b xcb xc -- &&
118 # no commits in bc descend from cb
119 test_expect_success
'criss-cross: rev-list --ancestry-path cb..bc' '
121 git rev-list --ancestry-path xcb..xbc > actual &&
122 test_must_be_empty actual)
125 # no commits in repository descend from cb
126 test_expect_success
'criss-cross: rev-list --ancestry-path --all ^cb' '
128 git rev-list --ancestry-path --all ^xcb > actual &&
129 test_must_be_empty actual)