summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ae7aa49)
raw | patch | inline | side by side (parent: ae7aa49)
author | Junio C Hamano <gitster@pobox.com> | |
Mon, 9 Jul 2007 02:03:19 +0000 (19:03 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 9 Jul 2007 06:18:08 +0000 (23:18 -0700) |
When we simplify history due to path limits, the parents list
for a rewritten commit can end up having duplicates. Instead of
filtering them out in the output codepath like earlier commit
88494423 did, remove them much earlier, when the parent
information actually gets rewritten.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
for a rewritten commit can end up having duplicates. Instead of
filtering them out in the output codepath like earlier commit
88494423 did, remove them much earlier, when the parent
information actually gets rewritten.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
revision.c | patch | blob | history |
diff --git a/revision.c b/revision.c
index 5184716bf0af35298d2a1bd3b9411b518be09e14..33ee9ee3b2ad98f9d02f350c649a9af1bf2aff0f 100644 (file)
--- a/revision.c
+++ b/revision.c
@@ -1308,6 +1308,25 @@ static enum rewrite_result rewrite_one(struct rev_info *revs, struct commit **pp
}
}
+static void remove_duplicate_parents(struct commit *commit)
+{
+ struct commit_list *p;
+ struct commit_list **pp = &commit->parents;
+
+ /* Examine existing parents while marking ones we have seen... */
+ for (p = commit->parents; p; p = p->next) {
+ struct commit *parent = p->item;
+ if (parent->object.flags & TMP_MARK)
+ continue;
+ parent->object.flags |= TMP_MARK;
+ *pp = p;
+ pp = &p->next;
+ }
+ /* ... and clear the temporary mark */
+ for (p = commit->parents; p; p = p->next)
+ p->item->object.flags &= ~TMP_MARK;
+}
+
static int rewrite_parents(struct rev_info *revs, struct commit *commit)
{
struct commit_list **pp = &commit->parents;
}
pp = &parent->next;
}
+ remove_duplicate_parents(commit);
return 0;
}