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
32 TEST_PASSES_SANITIZE_LEAK
=true
37 git merge
-s ours
-m "$2" "$1" &&
41 test_expect_success setup
'
62 test_expect_success
"log $args" "
63 test_write_lines $expected >expect &&
64 git log --format=%s $args >raw &&
66 if test -n \"$expected\"
69 test_cmp expect actual
71 test_must_be_empty raw
76 test_ancestry
"D..M" "E F G H I J K L M"
78 test_ancestry
"--ancestry-path D..M" "E F H I J L M"
79 test_ancestry
"--ancestry-path=F D..M" "E F J L M"
80 test_ancestry
"--ancestry-path=G D..M" "G H I J L M"
81 test_ancestry
"--ancestry-path=H D..M" "E G H I J L M"
82 test_ancestry
"--ancestry-path=K D..M" "K L M"
83 test_ancestry
"--ancestry-path=F --ancestry-path=K D..M" "E F J K L M"
85 test_ancestry
"D..M -- M.t" "M"
86 test_ancestry
"--ancestry-path D..M -- M.t" "M"
88 test_ancestry
"F...I" "F G H I"
89 test_ancestry
"--ancestry-path F...I" "F H I"
91 test_ancestry
"G..M -- G.t" ""
92 test_ancestry
"--ancestry-path G..M -- G.t" "L"
93 test_ancestry
"--ancestry-path --simplify-merges G^..M -- G.t" "G L"
101 # All refnames prefixed with 'x' to avoid confusion with the tags
102 # generated by test_commit on case-insensitive systems.
103 test_expect_success
'setup criss-cross' '
108 git checkout -b xb main &&
110 git checkout -b xc main &&
112 git checkout -b xbc xb -- &&
114 git checkout -b xcb xc -- &&
119 # no commits in bc descend from cb
120 test_expect_success
'criss-cross: rev-list --ancestry-path cb..bc' '
122 git rev-list --ancestry-path xcb..xbc > actual &&
123 test_must_be_empty actual)
126 # no commits in repository descend from cb
127 test_expect_success
'criss-cross: rev-list --ancestry-path --all ^cb' '
129 git rev-list --ancestry-path --all ^xcb > actual &&
130 test_must_be_empty actual)