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: Thu, 23 Apr 2020 14:36:53 -0700 [thread overview]
Message-ID: <xmqqk125g9ze.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <20200423210303.GA1635761@coredump.intra.peff.net> (Jeff King's message of "Thu, 23 Apr 2020 17:03:03 -0400")
Jeff King <peff@peff.net> writes:
> We don't use the "parent" parameter at all (probably because the bloom
> filter for a commit is always defined against a single parent anyway).
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> This is on top of ds/blame-on-bloom, which just made it to next.
>
> I _think_ this is the right solution, but perhaps the function should be
> verifying that we're looking at the right parent?
Hmph, "solution" to what problem? Ah, the fact that parent is an
unused parameter?
find_origin() runs a tree-diff over "parent" and "origin->commit",
with literal pathspec limited to the single path.
And the Bloom filter addition changed the code so that we first
consult the filter when "origin->commit"'s first parent *is*
"parent". Presumably, by asking maybe_changed_path about "origin",
as "origin" knows what the commit is (i.e. "origin->commit") and
what path we are talking about (i.e. "origin->path"), it can answer
"does origin->commit change origin->path relative to its first
parent?" and it can do so only for the first parent?
The way I read bloom.c::get_bloom_filter(), it only computes a
diff-tree between the given commit and its first parent (or an empty
tree), so I think the above is correct.
Thanks.
>
> blame.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/blame.c b/blame.c
> index 9fbf79e47c..da7e28800e 100644
> --- a/blame.c
> +++ b/blame.c
> @@ -1263,7 +1263,6 @@ struct blame_bloom_data {
> static int bloom_count_queries = 0;
> static int bloom_count_no = 0;
> static int maybe_changed_path(struct repository *r,
> - struct commit *parent,
> struct blame_origin *origin,
> struct blame_bloom_data *bd)
> {
> @@ -1355,8 +1354,7 @@ static struct blame_origin *find_origin(struct repository *r,
> if (origin->commit->parents &&
> !oidcmp(&parent->object.oid,
> &origin->commit->parents->item->object.oid))
> - compute_diff = maybe_changed_path(r, parent,
> - origin, bd);
> + compute_diff = maybe_changed_path(r, origin, bd);
>
> if (compute_diff)
> diff_tree_oid(get_commit_tree_oid(parent),
next prev parent reply other threads:[~2020-04-23 21:37 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 [this message]
2020-04-24 4:32 ` Jeff King
2020-04-24 20:18 ` Junio C Hamano
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=xmqqk125g9ze.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).