diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-06-08 14:56:03 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-06-13 14:04:33 -0700 |
commit | 6e513ba3a624a57fcf9e0f316ba54b3e0c951286 (patch) | |
tree | 9812db9bfb405d2eb8373a4368c0f485d8f2cec9 /revision.c | |
parent | ab9d75a8d7e48e03ab0be9fc5e38902f1c173b87 (diff) | |
download | git-6e513ba3a624a57fcf9e0f316ba54b3e0c951286.tar.gz |
revision: ignore side parents while running simplify-merges
The simplify_merges() function needs to look at all history chain to
find the closest ancestor that is relevant after the simplification,
but after --first-parent traversal, side parents haven't been marked
for relevance (they are irrelevant by definition due to the nature
of first-parent-only traversal) nor culled from the parents list of
resulting commits.
We cannot simply remove these side parents from the parents list, as
the output phase still wants to see the parents. Instead, teach
simplify_one() and its callees to ignore the later parents.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'revision.c')
-rw-r--r-- | revision.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/revision.c b/revision.c index 814b96ff53..d1a4ef5da0 100644 --- a/revision.c +++ b/revision.c @@ -1949,8 +1949,9 @@ static struct commit_list **simplify_one(struct rev_info *revs, struct commit *c } /* - * Do we know what commit all of our parents should be rewritten to? - * Otherwise we are not ready to rewrite this one yet. + * Do we know what commit all of our parents that matter + * should be rewritten to? Otherwise we are not ready to + * rewrite this one yet. */ for (cnt = 0, p = commit->parents; p; p = p->next) { pst = locate_simplify_state(revs, p->item); @@ -1958,6 +1959,8 @@ static struct commit_list **simplify_one(struct rev_info *revs, struct commit *c tail = &commit_list_insert(p->item, tail)->next; cnt++; } + if (revs->first_parent_only) + break; } if (cnt) { tail = &commit_list_insert(commit, tail)->next; @@ -1970,8 +1973,13 @@ static struct commit_list **simplify_one(struct rev_info *revs, struct commit *c for (p = commit->parents; p; p = p->next) { pst = locate_simplify_state(revs, p->item); p->item = pst->simplified; + if (revs->first_parent_only) + break; } - cnt = remove_duplicate_parents(commit); + if (!revs->first_parent_only) + cnt = remove_duplicate_parents(commit); + else + cnt = 1; /* * It is possible that we are a merge and one side branch |