From: Han Xin <hanxin.hx@bytedance.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jonathan Tan <jonathantanmy@google.com>,
git@vger.kernel.org, steadmon@google.com, me@ttaylorr.com
Subject: Re: [External] Re: [PATCH v2 2/2] fetch-pack: warn if in commit graph but not obj db
Date: Fri, 1 Nov 2024 16:59:30 +0800 [thread overview]
Message-ID: <CAKgqsWWo2r37nsxeYErXjEgrSepBgFpdde9bXuYDTfu4MC3+Ag@mail.gmail.com> (raw)
In-Reply-To: <xmqqcyjf4m3h.fsf@gitster.g>
On Fri, Nov 1, 2024 at 12:25 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> Junio C Hamano <gitster@pobox.com> writes:
>
> >> commit = lookup_commit_in_graph(the_repository, oid);
> >> - if (commit)
> >> + if (commit) {
> >> + if (mark_tags_complete_and_check_obj_db) {
> >> + if (!has_object(the_repository, oid, 0))
> >> + die_in_commit_graph_only(oid);
> >> + }
> >> return commit;
> >> + }
> >
> > Hmph, even when we are not doing the mark-tags-complete thing,
> > wouldn't it be a fatal error if the commit graph claims a commit
> > exists but we are missing it?
> >
> > It also makes me wonder if it would be sufficient to prevent us from
> > saying "have X" if we just pretend as if lookup_commit_in_graph()
> > returned NULL in this case.
>
> Again, sorry for the noise.
>
> I think the posted patch is better without either of these two,
> simply because the "commit graph lies" case is a repository
> corruption, and "git fsck" should catch such a corruption (and if
> not, we should make sure it does).
>
> The normal codepaths should assume a healthy working repository.
>
> As has_object() is not without cost, an extra check is warranted
> only because not checking will go into infinite recursion. If it
> does not make us fail in such an unpleasant way if we return such a
> commit when we are not doing the mark-tags-complete thing (but makes
> us fail in some other controlled way), not paying cost for an extra
> check is the right thing.
>
> Thanks.
Although the scenario I faked in t/t5330-no-lazy-fetch-with-commit-graph.sh
usually does not occur, if we are unfortunate enough to encounter this issue,
I hope it can automatically fix the problem as much as possible without
relying on me to take an extra action.
Thanks.
next prev parent reply other threads:[~2024-11-01 8:59 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-03 22:35 [RFC PATCH] promisor-remote: always JIT fetch with --refetch Emily Shaffer
2024-10-06 22:43 ` Junio C Hamano
2024-10-07 0:21 ` Robert Coup
2024-10-07 0:37 ` Junio C Hamano
2024-10-11 16:40 ` Emily Shaffer
2024-10-11 17:54 ` Junio C Hamano
2024-10-23 0:28 ` [PATCH v2] fetch-pack: don't mark COMPLETE unless we have the full object Emily Shaffer
2024-10-23 18:53 ` Emily Shaffer
2024-10-23 20:11 ` Taylor Blau
2024-10-28 22:55 ` Jonathan Tan
2024-10-29 21:11 ` [PATCH 0/2] When fetching, warn if in commit graph but not obj db Jonathan Tan
2024-10-29 21:11 ` [PATCH 1/2] Revert "fetch-pack: add a deref_without_lazy_fetch_extended()" Jonathan Tan
2024-10-30 21:22 ` Josh Steadmon
2024-10-29 21:11 ` [PATCH 2/2] fetch-pack: warn if in commit graph but not obj db Jonathan Tan
2024-10-30 21:22 ` Josh Steadmon
2024-10-31 21:23 ` Jonathan Tan
2024-10-31 20:59 ` Taylor Blau
2024-10-31 21:43 ` Jonathan Tan
2024-11-01 14:33 ` Taylor Blau
2024-11-01 17:33 ` Jonathan Tan
2024-10-30 21:22 ` [PATCH 0/2] When fetching, " Josh Steadmon
2024-10-31 21:18 ` [PATCH v2 0/2] When fetching, die " Jonathan Tan
2024-10-31 21:19 ` [PATCH v2 1/2] Revert "fetch-pack: add a deref_without_lazy_fetch_extended()" Jonathan Tan
2024-10-31 21:19 ` [PATCH v2 2/2] fetch-pack: warn if in commit graph but not obj db Jonathan Tan
2024-11-01 2:22 ` Junio C Hamano
2024-11-01 4:25 ` Junio C Hamano
2024-11-01 8:59 ` Han Xin [this message]
2024-11-01 17:46 ` [External] " Jonathan Tan
2024-11-01 17:40 ` Jonathan Tan
2024-11-02 2:08 ` Junio C Hamano
2024-11-01 17:36 ` Jonathan Tan
2024-11-01 15:18 ` Taylor Blau
2024-11-01 17:49 ` Jonathan Tan
2024-10-31 22:33 ` [PATCH v2 0/2] When fetching, die " Josh Steadmon
2024-11-05 19:24 ` [PATCH v3 " Jonathan Tan
2024-11-05 19:24 ` [PATCH v3 1/2] Revert "fetch-pack: add a deref_without_lazy_fetch_extended()" Jonathan Tan
2024-11-05 19:24 ` [PATCH v3 2/2] fetch-pack: die if in commit graph but not obj db Jonathan Tan
2024-11-06 3:12 ` [PATCH v3 0/2] When fetching, " 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=CAKgqsWWo2r37nsxeYErXjEgrSepBgFpdde9bXuYDTfu4MC3+Ag@mail.gmail.com \
--to=hanxin.hx@bytedance.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jonathantanmy@google.com \
--cc=me@ttaylorr.com \
--cc=steadmon@google.com \
/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).