summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Linus Torvalds <torvalds@linux-foundation.org>2007-07-20 23:11:19 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2007-07-20 23:36:39 -0700
commite1abc69b72401c5b2eb0e402e0fe10e8e0e5db27 (patch)
treee5727345b40e12e95fd5d12e556021af32227ab5
parentgitweb cleanup: Move @diff_opts declaration earlier (diff)
downloadtgif-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>
-rw-r--r--revision.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/revision.c b/revision.c
index 28b5f2eace..7036cf2246 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 */