From: Derrick Stolee <derrickstolee@github.com>
To: Taylor Blau <me@ttaylorr.com>, git@vger.kernel.org
Cc: gitster@pobox.com, peff@peff.net, ps@pks.im, wfc@wfchandler.org
Subject: Re: [PATCH 2/3] commit-graph: introduce `repo_find_commit_pos_in_graph()`
Date: Thu, 14 Jul 2022 23:17:48 -0400 [thread overview]
Message-ID: <3036d949-63b2-9d6c-b3f6-0075fe9e1ca5@github.com> (raw)
In-Reply-To: <e988c974119edbabc06dae6d24810fc0bafbdc94.1657667404.git.me@ttaylorr.com>
On 7/12/2022 7:10 PM, Taylor Blau wrote:
> +int repo_find_commit_pos_in_graph(struct repository *r, struct commit *c,
> + uint32_t *pos)
> +{
> + if (!prepare_commit_graph(r))
> + return 0;
> + return find_commit_pos_in_graph(c, r->objects->commit_graph, pos);
> +}
> +
This is absolutely correct for the given prototype.
> void load_commit_graph_info(struct repository *r, struct commit *item)
> {
> uint32_t pos;
> - if (!prepare_commit_graph(r))
> - return;
> - if (find_commit_pos_in_graph(item, r->objects->commit_graph, &pos))
> + if (repo_find_commit_pos_in_graph(r, item, &pos))
> fill_commit_graph_info(item, r->objects->commit_graph, pos);
Normally I would complain about referring directly to r->objects->commit_graph
without an explicit prepare_commit_graph() in the method. My initial thought
was that we would need to know that the new method prepares the graph, but
obviously the commit-graph needs to exist and be prepared if we are loading a
position from it.
All good here.
Thanks,
-Stolee
next prev parent reply other threads:[~2022-07-15 3:17 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-12 23:10 [PATCH 0/3] commit-graph: fix corruption during generation v2 upgrade Taylor Blau
2022-07-12 23:10 ` [PATCH 1/3] t5318: demonstrate commit-graph generation v2 corruption Taylor Blau
2022-07-15 3:15 ` Derrick Stolee
2022-07-15 22:05 ` Taylor Blau
2022-07-16 0:01 ` Junio C Hamano
2022-07-16 0:17 ` Taylor Blau
2022-07-12 23:10 ` [PATCH 2/3] commit-graph: introduce `repo_find_commit_pos_in_graph()` Taylor Blau
2022-07-15 3:17 ` Derrick Stolee [this message]
2022-07-12 23:10 ` [PATCH 3/3] commit-graph: fix corrupt upgrade from generation v1 to v2 Taylor Blau
2022-07-13 17:41 ` [PATCH 0/3] commit-graph: fix corruption during generation v2 upgrade Junio C Hamano
2022-07-15 2:02 ` Taylor Blau
2022-07-15 3:20 ` Derrick Stolee
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3036d949-63b2-9d6c-b3f6-0075fe9e1ca5@github.com \
--to=derrickstolee@github.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=me@ttaylorr.com \
--cc=peff@peff.net \
--cc=ps@pks.im \
--cc=wfc@wfchandler.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).