aboutsummaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2007-07-20 23:11:19 -0700
committerJunio C Hamano <gitster@pobox.com>2007-07-20 23:36:39 -0700
commite1abc69b72401c5b2eb0e402e0fe10e8e0e5db27 (patch)
treee5727345b40e12e95fd5d12e556021af32227ab5 /revision.c
parent69a9b41c15f25e1e91df5d9c4d5e3d56706f8f0e (diff)
downloadgit-e1abc69b72401c5b2eb0e402e0fe10e8e0e5db27.tar.gz
git-e1abc69b72401c5b2eb0e402e0fe10e8e0e5db27.tar.xz
Fix up duplicate parents removal
This removes duplicate parents properly, making gitk happy again. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/revision.c b/revision.c
index 28b5f2eac..7036cf224 100644
--- a/revision.c
+++ b/revision.c
@@ -1323,16 +1323,17 @@ 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;
+ struct commit_list **pp, *p;
/* Examine existing parents while marking ones we have seen... */
- for (p = commit->parents; p; p = p->next) {
+ pp = &commit->parents;
+ while ((p = *pp) != NULL) {
struct commit *parent = p->item;
- if (parent->object.flags & TMP_MARK)
+ if (parent->object.flags & TMP_MARK) {
+ *pp = p->next;
continue;
+ }
parent->object.flags |= TMP_MARK;
- *pp = p;
pp = &p->next;
}
/* ... and clear the temporary mark */