From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, Derrick Stolee <dstolee@microsoft.com>
Subject: Re: [PATCH] blame: drop unused parameter from maybe_changed_path
Date: Fri, 24 Apr 2020 13:18:57 -0700 [thread overview]
Message-ID: <xmqqimhod4cu.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <20200424043225.GB1648190@coredump.intra.peff.net> (Jeff King's message of "Fri, 24 Apr 2020 00:32:25 -0400")
Jeff King <peff@peff.net> writes:
> If the bloom filter also computes against an empty tree for root
> commits (I didn't check, but that would make sense), I think that AND
> could be an OR:
>
> if (!origin->commit->parents ||
> !oidcmp(...))
>
> though it probably doesn't matter that much in practice. Root commits
> are rather rare.
Correct. I just followed the code from bloom.c::get_bloom_filter()
down, and for a root commit, diff_tree_oid() with NULL in the first
parameter (i.e. old_oid) is called. This NULL pointer eventually
reaches tree-walk.c::fill_tree_descriptor() and the function just
gives an empty tree in that case, which is what we want.
>
> BTW, we could also be using oideq() here. I thought coccicheck would
> note this, but it doesn't seem to. I suspect we could also get away with
> a direct pointer comparison of "parent == origin->commit->parents->item"
> due to the way we allocate "struct commit", but I'd rather err on the
> safer and less subtle side. :)
True. oideq() is probably an improvement; I agree that pointer
equality is taking it too far.
prev parent reply other threads:[~2020-04-24 20:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-23 21:03 [PATCH] blame: drop unused parameter from maybe_changed_path Jeff King
2020-04-23 21:36 ` Junio C Hamano
2020-04-24 4:32 ` Jeff King
2020-04-24 20:18 ` Junio C Hamano [this message]
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=xmqqimhod4cu.fsf@gitster.c.googlers.com \
--to=gitster@pobox.com \
--cc=dstolee@microsoft.com \
--cc=git@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).