X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=revision.c;h=18be62b3169095b908cb521cf9be211a9339029d;hb=67f8d5b87d8ec3dcdb311f31b534332b74c93142;hp=89d3a8fafbe5d066a63c9b1f42113c7de5577c5c;hpb=c876d6da88d9bf1f3377d4eed66fc7705e31c30e;p=git.git diff --git a/revision.c b/revision.c index 89d3a8faf..18be62b31 100644 --- a/revision.c +++ b/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),