git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] blame: drop unused parameter from maybe_changed_path

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 24, 2020, 20:18 UTC
Message-ID
<xmqqimhod4cu.fsf@gitster.c.googlers.com>
In-Reply-To
<20200424043225.GB1648190@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 9 quoted lines
> 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.

Show 6 quoted lines
>
> 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.

Previous: Jeff King
Message 4 of 4 in “blame: drop unused parameter from maybe_changed_path”
  1. blame: drop unused parameter from maybe_changed_pathJeff King, Apr 23, 2020
  2. Junio C HamanoApr 23, 2020
  3. Jeff KingApr 24, 2020
  4. Junio C HamanoApr 24, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.