Merge branch 'jc/maint-log-first-parent-pathspec'
* jc/maint-log-first-parent-pathspec: Making pathspec limited log play nicer with --first-parent
This commit is contained in:
commit
731218c18f
10
revision.c
10
revision.c
@ -416,7 +416,7 @@ static int rev_same_tree_as_empty(struct rev_info *revs, struct commit *commit)
|
||||
static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)
|
||||
{
|
||||
struct commit_list **pp, *parent;
|
||||
int tree_changed = 0, tree_same = 0;
|
||||
int tree_changed = 0, tree_same = 0, nth_parent = 0;
|
||||
|
||||
/*
|
||||
* If we don't do pruning, everything is interesting
|
||||
@ -444,6 +444,14 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)
|
||||
while ((parent = *pp) != NULL) {
|
||||
struct commit *p = parent->item;
|
||||
|
||||
/*
|
||||
* Do not compare with later parents when we care only about
|
||||
* the first parent chain, in order to avoid derailing the
|
||||
* traversal to follow a side branch that brought everything
|
||||
* in the path we are limited to by the pathspec.
|
||||
*/
|
||||
if (revs->first_parent_only && nth_parent++)
|
||||
break;
|
||||
if (parse_commit(p) < 0)
|
||||
die("cannot simplify commit %s (because of %s)",
|
||||
sha1_to_hex(commit->object.sha1),
|
||||
|
@ -86,5 +86,6 @@ check_result 'I H E C B A' --full-history --date-order -- file
|
||||
check_result 'I E C B A' --simplify-merges -- file
|
||||
check_result 'I B A' -- file
|
||||
check_result 'I B A' --topo-order -- file
|
||||
check_result 'H' --first-parent -- another-file
|
||||
|
||||
test_done
|
||||
|
Loading…
Reference in New Issue
Block a user