From: Junio C Hamano <gitster@pobox.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Jeff King <peff@peff.net>, git@vger.kernel.org
Subject: Re: [RFH] revision limiting sometimes ignored
Date: Mon, 04 Feb 2008 11:08:47 -0800 [thread overview]
Message-ID: <7vr6fsk08w.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <alpine.LFD.1.00.0802040922480.3034@hp.linux-foundation.org> (Linus Torvalds's message of "Mon, 4 Feb 2008 09:32:15 -0800 (PST)")
Linus Torvalds <torvalds@linux-foundation.org> writes:
> So I think the real problem here is not that the logic is wrong in
> general, but that there is one *special* case where the logic to break out
> is wrong.
>
> And that special case is when we hit the root commit which isn't negative.
>
> That case is special because *normally*, if we have a positive commit, we
> will always continue to walk the parents of that positive commit, so the
> "everybody_interesting()" check will not trigger. BUT! If we hit a root
> commit and it is positive, that won't happen (since, by definition, it has
> no parents to keep the list populated with), and now we break out early.
>
> So I think your fix is wrong, but it's "close" to right: I suspect that we
> can fix it by marking the "we hit the root commit" case, and just
> disabling it for that case.
Ahh, I was preparing a response that begins with "Wow, a joy of
working in a mailing list with people more clever than me! It's
so obvious but I did not think of it." I've written something
like that more than a few times on this list responding to
several people, I think.
However, I am afraid that is not quite enough. It is not just
"when we hit the root".
Consider the same topology in the small test (1-2-3-4) but with
three additional commits:
B---C
/
---A---1---2---3---4
Again, 2-3-4 are in nice chronological order, but 1 has the
younguest timestamp, and A-B-C are all younger than 1.
$ rev-list 1 ^4 ^A
$ rev-list 1 ^4 ^B
These two would both mark A as uninteresting while processing
the command line (revision.c::handle_commit()). When we pop 1
off, the call to add_parents_to_list() for it will not add
anything positive back.
$ rev-list 1 ^4 ^C
This would not mark A as uninteresting immediately, but by the
time 1 gets its turn, A is marked uninteresting.
So I think the rule to notice this situation with "hit-root"
flag is something like:
when we pop a positive commit that does not have any
positive parent left (root is a special case of this), and
the negative parents were contaminated either by:
(1) being listed as negative on the command line or being a
direct parent of a negative commit listed on the
command line; or by
(2) traversing the list of negative commits who are all
younger than the positive commit in question.
---
t/t6009-rev-list-parent.sh | 36 ++++++++++++++++++++++++++++++++++--
1 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/t/t6009-rev-list-parent.sh b/t/t6009-rev-list-parent.sh
index be3d238..0bb5ac4 100755
--- a/t/t6009-rev-list-parent.sh
+++ b/t/t6009-rev-list-parent.sh
@@ -16,6 +16,14 @@ test_expect_success setup '
touch file &&
git add file &&
+ commit zero &&
+ commit A &&
+ commit B &&
+ commit C &&
+
+ git reset --hard A &&
+
+ test_tick=$(($test_tick - 1200))
commit one &&
test_tick=$(($test_tick - 2400))
@@ -27,9 +35,33 @@ test_expect_success setup '
git log --pretty=oneline --abbrev-commit
'
-test_expect_failure 'one is ancestor of others and should not be shown' '
+test_expect_failure '"zero ^four" should be empty' '
+
+ git rev-list zero --not four >result &&
+ >expect &&
+ diff -u expect result
+
+'
+
+test_expect_failure '"one ^four ^A" should be empty' '
+
+ git rev-list one --not four A >result &&
+ >expect &&
+ diff -u expect result
+
+'
+
+test_expect_failure '"one ^four ^B should be empty' '
+
+ git rev-list one --not four B >result &&
+ >expect &&
+ diff -u expect result
+
+'
+
+test_expect_failure '"one ^four ^C should be empty' '
- git rev-list one --not four >result &&
+ git rev-list one --not four C >result &&
>expect &&
diff -u expect result
next prev parent reply other threads:[~2008-02-04 19:09 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-02 12:21 [BUG?] git log picks up bad commit Tilman Sauerbeck
2008-02-03 3:00 ` Jeff King
2008-02-03 4:33 ` [RFH] revision limiting sometimes ignored Jeff King
2008-02-03 6:24 ` Junio C Hamano
2008-02-03 6:39 ` Junio C Hamano
2008-02-03 7:13 ` Jeff King
2008-02-03 7:18 ` Jeff King
2008-02-03 7:40 ` Junio C Hamano
2008-02-03 7:47 ` Junio C Hamano
2008-02-03 8:18 ` Junio C Hamano
2008-02-04 17:32 ` Linus Torvalds
2008-02-04 17:37 ` Linus Torvalds
2008-02-04 19:08 ` Junio C Hamano [this message]
2008-02-04 20:03 ` Linus Torvalds
2008-02-04 20:06 ` Linus Torvalds
2008-02-04 20:50 ` Linus Torvalds
2008-02-05 7:14 ` Junio C Hamano
2008-02-05 21:23 ` Linus Torvalds
2008-02-05 22:34 ` Johannes Schindelin
2008-02-05 23:59 ` Linus Torvalds
2008-02-06 16:43 ` Tilman Sauerbeck
2008-02-06 17:28 ` Nicolas Pitre
2008-02-06 17:42 ` Linus Torvalds
2008-02-06 17:48 ` Nicolas Pitre
2008-02-06 19:26 ` Linus Torvalds
2008-02-06 1:22 ` Nicolas Pitre
2008-02-06 1:51 ` Junio C Hamano
2008-02-06 6:05 ` Junio C Hamano
2008-02-06 6:17 ` Junio C Hamano
2008-02-05 23:44 ` Junio C Hamano
2008-02-06 0:52 ` Linus Torvalds
2008-02-06 5:30 ` Junio C Hamano
2008-02-06 8:16 ` Karl Hasselström
2008-02-06 10:34 ` Linus Torvalds
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=7vr6fsk08w.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=torvalds@linux-foundation.org \
/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;
as well as URLs for NNTP newsgroup(s).