3 # ,---E--. *H----------. * marks !TREESAME parent paths
5 # *A--*B---D--*F-*G---------K-*L-*M
9 # A creates "file", B and F change it.
10 # Odd merge G takes the old version from B.
11 # I changes it, but J reverts it, so K is TREESAME to both parents.
12 # H and L both change "file", and M merges those changes.
14 test_description
='TREESAME and limiting'
16 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
=main
17 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
26 git name-rev
--tags --annotate-stdin | \
27 sed -e "s|$OID_REGEX (tags/\([^)]*\))\([ ]\)|\1\2|g"
30 test_expect_success setup
'
31 test_commit "Initial file" file "Hi there" A &&
32 git branch other-branch &&
34 test_commit "file=Hello" file "Hello" B &&
35 git branch third-branch &&
37 git checkout other-branch &&
38 test_commit "Added other" other "Hello" C &&
41 test_merge D other-branch &&
43 git checkout third-branch &&
44 test_commit "Third file" third "Nothing" E &&
47 test_commit "file=Blah" file "Blah" F &&
49 test_tick && git merge --no-commit third-branch &&
50 git checkout third-branch file &&
53 git branch fiddler-branch &&
55 git checkout -b part2-branch &&
56 test_commit "file=Part 2" file "Part 2" H &&
58 git checkout fiddler-branch &&
59 test_commit "Bad commit" file "Silly" I &&
61 test_tick && git revert I && note J &&
64 test_tick && git merge --no-ff fiddler-branch &&
67 test_commit "file=Part 1" file "Part 1" L &&
69 test_tick && test_must_fail git merge part2-branch &&
70 test_commit M file "Parts 1+2"
81 s/^\([^ ]*\) \([^ ]*\) .*/(\1)\2/
88 munge_actual
="s/^\([^ ]*\) .*/\1/"
91 printf "%s\n" $1 >expect
&&
95 test_expect_
$outcome "log $param" '
96 git log --format="$FMT" $param |
98 sed -e "$munge_actual" <actual >check &&
104 check_outcome success
"$@"
107 # Odd merge G drops a change in F. Important that G is listed in all
108 # except the most basic list. Achieving this means normal merge D will also be
109 # shown in normal full-history, as we can't distinguish unless we do a
110 # simplification pass. After simplification, D is dropped but G remains.
111 # Also, merge simplification of G should not drop the parent B that the default
112 # simple history follows.
113 check_result
'M L K J I H G F E D C B A'
114 check_result
'(LH)M (K)L (GJ)K (I)J (G)I (G)H (FE)G (D)F (B)E (BC)D (A)C (A)B A'
115 check_result
'M H L K J I G E F D C B A' --topo-order
116 check_result
'M L H B A' -- file
117 check_result
'(LH)M (B)L (B)H (A)B A' --parents -- file
118 check_result
'M L J I H G F D B A' --full-history -- file
119 check_result
'(LH)M (K)L (GJ)K (I)J (G)I (G)H (FB)G (D)F (BA)D (A)B A' --full-history --parents -- file
120 check_result
'(LH)M (G)H (J)L (I)J (G)I (FB)G (B)F (A)B A' --simplify-merges -- file
121 check_result
'M L K G F D B A' --first-parent
122 check_result
'M L G F B A' --first-parent -- file
124 # Check that odd merge G remains shown when F is the bottom.
125 check_result
'M L K J I H G E' F..M
126 check_result
'M H L K J I G E' F..M
--topo-order
127 check_result
'M L H' F..M
-- file
128 check_result
'(LH)M (B)L (B)H' --parents F..M
-- file
129 check_result
'M L J I H G' F..M
--full-history -- file
130 check_result
'(LH)M (K)L (GJ)K (I)J (G)I (G)H (FB)G' F..M
--full-history --parents -- file
131 check_result
'(LH)M (G)H (J)L (I)J (G)I (FB)G' F..M
--simplify-merges -- file
132 check_result
'M L K J I H G' F..M
--ancestry-path
133 check_result
'M L J I H G' F..M
--ancestry-path -- file
134 check_result
'(LH)M (K)L (GJ)K (I)J (G)I (G)H (FE)G' F..M
--ancestry-path --parents -- file
135 check_result
'(LH)M (G)H (J)L (I)J (G)I (FE)G' F..M
--ancestry-path --simplify-merges -- file
136 check_result
'M L K G' F..M
--first-parent
137 check_result
'M L G' F..M
--first-parent -- file
139 # Note that G is pruned when E is the bottom, even if it's the same commit list
140 # If we want history since E, then we're quite happy to ignore G that took E.
141 check_result
'M L K J I H G' E..M
--ancestry-path
142 check_result
'M L J I H' E..M
--ancestry-path -- file
143 check_result
'(LH)M (K)L (EJ)K (I)J (E)I (E)H' E..M
--ancestry-path --parents -- file
144 check_result
'(LH)M (E)H (J)L (I)J (E)I' E..M
--ancestry-path --simplify-merges -- file
146 # Should still be able to ignore I-J branch in simple log, despite limiting
148 check_result
'M L K J I H' G..M
149 check_result
'M H L K J I' G..M
--topo-order
150 check_result
'M L H' G..M
-- file
151 check_result
'(LH)M (G)L (G)H' G..M
--parents -- file
152 check_result
'M L J I H' G..M
--full-history -- file
153 check_result
'M L K J I H' G..M
--full-history --parents -- file
154 check_result
'M H L J I' G..M
--simplify-merges -- file
155 check_result
'M L K J I H' G..M
--ancestry-path
156 check_result
'M L J I H' G..M
--ancestry-path -- file
157 check_result
'M L K J I H' G..M
--ancestry-path --parents -- file
158 check_result
'M H L J I' G..M
--ancestry-path --simplify-merges -- file
160 # B..F should be able to simplify the merge D from irrelevant side branch C.
161 # Default log should also be free to follow B-D, and ignore C.
162 # But --full-history shouldn't drop D on its own - without simplification,
163 # we can't decide if the merge from INTERESTING commit C was sensible.
164 check_result
'F D C' B..F
165 check_result
'F' B..F
-- file
166 check_result
'(B)F' B..F
--parents -- file
167 check_result
'F D' B..F
--full-history -- file
168 check_result
'(D)F (BA)D' B..F
--full-history --parents -- file
169 check_result
'(B)F' B..F
--simplify-merges -- file
170 check_result
'F D' B..F
--ancestry-path
171 check_result
'F' B..F
--ancestry-path -- file
172 check_result
'F' B..F
--ancestry-path --parents -- file
173 check_result
'F' B..F
--ancestry-path --simplify-merges -- file
174 check_result
'F D' B..F
--first-parent
175 check_result
'F' B..F
--first-parent -- file
177 # E...F should be equivalent to E F ^B, and be able to drop D as above.
178 check_result
'F' E F ^B
-- file # includes D
179 check_result
'F' E...F
-- file # includes D
181 # Any sort of full history of C..F should show D, as it's the connection to C,
182 # and it differs from it.
183 check_result
'F D B' C..F
184 check_result
'F B' C..F
-- file
185 check_result
'(B)F (A)B' C..F
--parents -- file
186 check_result
'F D B' C..F
--full-history -- file
187 check_result
'(D)F (BC)D (A)B' C..F
--full-history --parents -- file
188 check_result
'(D)F (BC)D (A)B' C..F
--simplify-merges -- file
189 check_result
'F D' C..F
--ancestry-path
190 check_result
'F D' C..F
--ancestry-path -- file
191 check_result
'F D' C..F
--ancestry-path --parents -- file
192 check_result
'F D' C..F
--ancestry-path --simplify-merges -- file
193 check_result
'F D B' C..F
--first-parent
194 check_result
'F B' C..F
--first-parent -- file