From: Linus Torvalds Date: Sat, 21 Jul 2007 06:11:19 +0000 (-0700) Subject: Fix up duplicate parents removal X-Git-Tag: v1.5.3-rc3~29 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e1abc69b72401c5b2eb0e402e0fe10e8e0e5db27;p=git.git Fix up duplicate parents removal This removes duplicate parents properly, making gitk happy again. Signed-off-by: Linus Torvalds Signed-off-by: Junio C Hamano --- 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 */