Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 141efdb

Browse files
kjbracey2gitster
authored andcommitted
revision.c: make default history consider bottom commits
Previously, the default history treated bottom commits the same as any other UNINTERESTING commit, which could force it down side branches. Consider the following history: *A--*B---D--*F * marks !TREESAME parent paths \ /* `-C-' When requesting "B..F", B is UNINTERESTING but TREESAME to D. C is !UNINTERESTING. So default following would go from D into the irrelevant side branch C to A, rather than to B. Note also that if there had been an extra !UNINTERESTING commit B1 between B and D, it wouldn't have gone down C. Change the default following to test relevant_commit() instead of !UNINTERESTING, so it can proceed straight from D to B, thus finishing the traversal of that path. Signed-off-by: Kevin Bracey <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bf3418b commit 141efdb

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

revision.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)
684684
sha1_to_hex(p->object.sha1));
685685
switch (rev_compare_tree(revs, p, commit)) {
686686
case REV_TREE_SAME:
687-
if (!revs->simplify_history || (p->object.flags & UNINTERESTING)) {
687+
if (!revs->simplify_history || !relevant_commit(p)) {
688688
/* Even if a merge with an uninteresting
689689
* side branch brought the entire change
690690
* we are interested in, we do not want

t/t6111-rev-list-treesame.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ check_result '(LH)M (E)H (J)L (I)J (E)I' E..M --ancestry-path --simplify-merges
146146
# to G.
147147
check_result 'M L K J I H' G..M
148148
check_result 'M H L K J I' G..M --topo-order
149-
check_outcome failure 'M L H' G..M -- file # includes J I
150-
check_outcome failure '(LH)M (G)L (G)H' G..M --parents -- file # includes J I
149+
check_result 'M L H' G..M -- file
150+
check_result '(LH)M (G)L (G)H' G..M --parents -- file
151151
check_result 'M L J I H' G..M --full-history -- file
152152
check_result 'M L K J I H' G..M --full-history --parents -- file
153153
check_result 'M H L J I' G..M --simplify-merges -- file
@@ -161,8 +161,8 @@ check_result 'M H L J I' G..M --ancestry-path --simplify-merges -- file
161161
# But --full-history shouldn't drop D on its own - without simplification,
162162
# we can't decide if the merge from INTERESTING commit C was sensible.
163163
check_result 'F D C' B..F
164-
check_outcome failure 'F' B..F -- file # includes D
165-
check_outcome failure '(B)F' B..F --parents -- file # includes D
164+
check_result 'F' B..F -- file
165+
check_result '(B)F' B..F --parents -- file
166166
check_result 'F D' B..F --full-history -- file
167167
check_result '(D)F (BA)D' B..F --full-history --parents -- file
168168
check_result '(B)F' B..F --simplify-merges -- file
@@ -174,8 +174,8 @@ check_result 'F D' B..F --first-parent
174174
check_result 'F' B..F --first-parent -- file
175175

176176
# E...F should be equivalent to E F ^B, and be able to drop D as above.
177-
check_outcome failure 'F' E F ^B -- file # includes D
178-
check_outcome failure 'F' E...F -- file # includes D
177+
check_result 'F' E F ^B -- file # includes D
178+
check_result 'F' E...F -- file # includes D
179179

180180
# Any sort of full history of C..F should show D, as it's the connection to C,
181181
# and it differs from it.

0 commit comments

Comments
 (0)