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>
This commit is contained in:

committed by
Junio C Hamano

parent
69a9b41c15
commit
e1abc69b72
11
revision.c
11
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)
|
static void remove_duplicate_parents(struct commit *commit)
|
||||||
{
|
{
|
||||||
struct commit_list *p;
|
struct commit_list **pp, *p;
|
||||||
struct commit_list **pp = &commit->parents;
|
|
||||||
|
|
||||||
/* Examine existing parents while marking ones we have seen... */
|
/* 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;
|
struct commit *parent = p->item;
|
||||||
if (parent->object.flags & TMP_MARK)
|
if (parent->object.flags & TMP_MARK) {
|
||||||
|
*pp = p->next;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
parent->object.flags |= TMP_MARK;
|
parent->object.flags |= TMP_MARK;
|
||||||
*pp = p;
|
|
||||||
pp = &p->next;
|
pp = &p->next;
|
||||||
}
|
}
|
||||||
/* ... and clear the temporary mark */
|
/* ... and clear the temporary mark */
|
||||||
|
Reference in New Issue
Block a user