Skip to content

Commit

Permalink
Fix up duplicate parents removal
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Linus Torvalds authored and Junio C Hamano committed Jul 21, 2007
1 parent 69a9b41 commit e1abc69
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions revision.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit e1abc69

Please sign in to comment.