From: Junio C Hamano <gitster@pobox.com>
To: Jonathan Tan <jonathantanmy@google.com>
Cc: git@vger.kernel.org, steadmon@google.com, me@ttaylorr.com,
hanxin.hx@bytedance.com
Subject: Re: [PATCH v2 2/2] fetch-pack: warn if in commit graph but not obj db
Date: Fri, 01 Nov 2024 19:08:22 -0700 [thread overview]
Message-ID: <xmqqttcqz8tl.fsf@gitster.g> (raw)
In-Reply-To: <20241101174054.684519-1-jonathantanmy@google.com> (Jonathan Tan's message of "Fri, 1 Nov 2024 10:40:54 -0700")
Jonathan Tan <jonathantanmy@google.com> writes:
> Junio C Hamano <gitster@pobox.com> writes:
>> 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.
>
> Just checking...by "the posted patch is better without either
> of these two", do you mean that we should not use has_object()
> here?
No, "these two" refers to two changes I hinted at in my message,
i.e. (1) regardless of mark_tags_complete_and_check_obj_db shouldn't
we check with has_object() and die? and (2) if we commit=NULL and
keep going, would it be sufficient to fix it?
next prev parent reply other threads:[~2024-11-02 2:08 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 ` [External] " Han Xin
2024-11-01 17:46 ` Jonathan Tan
2024-11-01 17:40 ` Jonathan Tan
2024-11-02 2:08 ` Junio C Hamano [this message]
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=xmqqttcqz8tl.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=hanxin.hx@bytedance.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).