From: Linus Torvalds <torvalds@linux-foundation.org>
To: Jeff King <peff@peff.net>
Cc: Git Mailing List <git@vger.kernel.org>,
Paul Mackerras <paulus@samba.org>,
Junio C Hamano <junkio@cox.net>
Subject: Re: gitk problems: can't unset "idinlist(...)"
Date: Fri, 20 Jul 2007 23:11:19 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.0.999.0707202304350.27249@woody.linux-foundation.org> (raw)
In-Reply-To: <alpine.LFD.0.999.0707202226130.27249@woody.linux-foundation.org>
On Fri, 20 Jul 2007, Linus Torvalds wrote:
>
> Junio, didn't we have some parent simplification patches recently?
Yeah. Junio, I think your 11d6596709e04b8d2b429f230b2ed570d013f812 is
buggy.
Here's a patch. Not very well tested, but it makes gitk happy and passes
all the tests. And I really think Junio's code was very dubious (it did
that "p = p->next" *every* time, and then did "pp = &p->next", so "pp"
would end up jumping by multiple entries.
The new code only ever changes "pp" - either by moving p->next into it
(delete the current entry) or by moving pp forward by one (keep the
current entry).
That's much more logical, but somebody should double-check me anyway.
Linus
---
Subject: Fix up duplicate parents removal
This removes duplicate parents properly, making gitk happy again.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
revision.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/revision.c b/revision.c
index 28b5f2e..7036cf2 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 */
next prev parent reply other threads:[~2007-07-21 6:12 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-20 23:05 gitk problems: can't unset "idinlist(...)" Linus Torvalds
2007-07-21 5:09 ` Jeff King
2007-07-21 5:53 ` Linus Torvalds
2007-07-21 5:56 ` Junio C Hamano
2007-07-21 5:59 ` Jeff King
2007-07-21 6:06 ` Jeff King
2007-07-21 6:11 ` Linus Torvalds [this message]
2007-07-21 6:18 ` Jeff King
2007-07-21 6:24 ` Jeff King
2007-07-21 6:47 ` Linus Torvalds
2007-07-21 6:54 ` Jeff King
2007-07-21 9:32 ` pointer to pointer (was: gitk problems: can't unset "idinlist(...)") David Kastrup
2007-07-21 9:44 ` pointer to pointer David Kastrup
2007-07-21 6:34 ` gitk problems: can't unset "idinlist(...)" Linus Torvalds
2007-07-21 11:42 ` Paul Mackerras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LFD.0.999.0707202304350.27249@woody.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
--cc=paulus@samba.org \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox