summaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-02-06 07:58:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-02-06 07:58:42 (GMT)
commite27d620e919f524ee0bfa0a4d1f35225d3cb867e (patch)
treed34c5ac6e921059fd3904ebbdb666da863ec0e5e /revision.c
parent4802997c7531835f16b6fce690854d9a75119d0b (diff)
parent36ed1913e1d5de0930e59db6eeec3ccb2bd58bd9 (diff)
downloadgit-e27d620e919f524ee0bfa0a4d1f35225d3cb867e.zip
git-e27d620e919f524ee0bfa0a4d1f35225d3cb867e.tar.gz
git-e27d620e919f524ee0bfa0a4d1f35225d3cb867e.tar.bz2
Merge branch 'jc/maint-log-first-parent-pathspec' into maint
* jc/maint-log-first-parent-pathspec: Making pathspec limited log play nicer with --first-parent
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/revision.c b/revision.c
index 064e351..eb0be42 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),