From: Patrick Steinhardt <ps@pks.im>
To: Karthik Nayak <karthik.188@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 07/13] builtin/index-pack: don't fetch promised objects for collision check
Date: Fri, 25 Apr 2025 09:04:55 +0200 [thread overview]
Message-ID: <aAs0F58Hlpn6WI6b@pks.im> (raw)
In-Reply-To: <CAOLa=ZQh+agLJYEGWU2O2=iRnJy94y9Cud3XRVaGVHC4YdbBZw@mail.gmail.com>
On Wed, Apr 23, 2025 at 10:08:05AM -0700, Karthik Nayak wrote:
> Patrick Steinhardt <ps@pks.im> writes:
>
> > Any packed objects indexed via git-index-pack(1) are subject to a
> > collision check. This collision check has the intent to determine
> > whether we already have an object with the same object ID, but different
> > contents in the repository.
> >
> > The check whether the collision check is really needed is performed via
> > `repo_has_object_file_with_flags(..., OBJECT_INFO_QUICK)`. \
> >
>
> Nit: this was a little confusing at first, until I saw the code. So what
> this means is that the collision check is only performed, iff
> `repo_has_object_file_with_flags(...)` returns true.
>
> I think the confusing part was 'is performed via', perhaps:
>
> The collision check is only performed, if
> repo_has_object_file_with_flags(..., OBJECT_INFO_QUICK) returns a
> truthy value.
>
> But it is okay as is too!
Will rephrase.
> > But unless
> > explicitly told otherwise via `OBJECT_INFO_SKIP_FETCH_OBJECT`, this
> > function will also cause us to fetch the object ID in case it is part of
> > a promisor pack. As such, we may end up fetching the object only to
> > check whether the fetched object and the object that we're indexing have
> > the same content.
> >
>
> So us fetching the object is pointless, since we only care about the
> 'does it exist' part and not really what it contains. In that case,
> shouldn't this be s/same content/same oid/?
No, it really checks for the same content. It basically verifies that
any pair of objects that:
- Exist in the packfile that we're currently indexing.
- And preexists in the local repository.
Actually have the same content.
The weird part is that we also do this for objects that don't yet exist
in the repository, but which are promised to us. This causes us to fetch
them first only to verify that the fetched promised object has the same
content as the packfile. And given that git-index-pack(1) would usually
run after a fetch, we end up verifying that the fetched object obtained
from the promisor is the same as the fetched object obtained from the
packfile. Which ultimately seems rather dubious to me.
Patrick
next prev parent reply other threads:[~2025-04-25 7:05 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-23 7:48 [PATCH 00/13] object-store: a handful of cleanups Patrick Steinhardt
2025-04-23 7:48 ` [PATCH 01/13] object-store: move `struct packed_git` into "packfile.h" Patrick Steinhardt
2025-04-23 7:48 ` [PATCH 02/13] object-store: drop `loose_object_path()` Patrick Steinhardt
2025-04-23 7:48 ` [PATCH 03/13] object-store: move and rename `odb_pack_keep()` Patrick Steinhardt
2025-04-23 10:03 ` Karthik Nayak
2025-04-23 7:48 ` [PATCH 04/13] object-store: move function declarations to their respective subsystems Patrick Steinhardt
2025-04-23 7:48 ` [PATCH 05/13] object-store: allow fetching objects via `has_object()` Patrick Steinhardt
2025-04-23 10:07 ` Karthik Nayak
2025-04-23 7:48 ` [PATCH 06/13] treewide: trivial conversions of `repo_has_object_file()` Patrick Steinhardt
2025-04-23 7:48 ` [PATCH 07/13] builtin/index-pack: don't fetch promised objects for collision check Patrick Steinhardt
2025-04-23 17:08 ` Karthik Nayak
2025-04-25 7:04 ` Patrick Steinhardt [this message]
2025-04-28 19:48 ` Karthik Nayak
2025-04-23 7:48 ` [PATCH 08/13] builtin/show-ref: don't fetch objects when printing refs Patrick Steinhardt
2025-04-23 7:48 ` [PATCH 09/13] refs: don't fetch promisor objects in `ref_resolves_to_object()` Patrick Steinhardt
2025-04-23 17:11 ` Karthik Nayak
2025-04-23 7:48 ` [PATCH 10/13] http-walker: don't fetch objects via promisor remotes Patrick Steinhardt
2025-04-23 7:48 ` [PATCH 11/13] list-objects: clarify how promised blobs are excluded Patrick Steinhardt
2025-04-23 7:48 ` [PATCH 12/13] bulk-checkin: don't fetch promised objects on write Patrick Steinhardt
2025-04-23 7:48 ` [PATCH 13/13] object-store: drop `repo_has_object_file()` Patrick Steinhardt
2025-04-23 17:20 ` [PATCH 00/13] object-store: a handful of cleanups Karthik Nayak
2025-04-25 7:07 ` Patrick Steinhardt
2025-04-25 7:08 ` [PATCH v2 " Patrick Steinhardt
2025-04-25 7:08 ` [PATCH v2 01/13] object-store: move `struct packed_git` into "packfile.h" Patrick Steinhardt
2025-04-25 7:08 ` [PATCH v2 02/13] object-store: drop `loose_object_path()` Patrick Steinhardt
2025-04-25 7:08 ` [PATCH v2 03/13] object-store: move and rename `odb_pack_keep()` Patrick Steinhardt
2025-04-25 7:08 ` [PATCH v2 04/13] object-store: move function declarations to their respective subsystems Patrick Steinhardt
2025-04-25 7:08 ` [PATCH v2 05/13] object-store: allow fetching objects via `has_object()` Patrick Steinhardt
2025-04-25 7:08 ` [PATCH v2 06/13] treewide: trivial conversions of `repo_has_object_file()` Patrick Steinhardt
2025-04-28 21:40 ` Junio C Hamano
2025-04-25 7:08 ` [PATCH v2 07/13] builtin/index-pack: don't fetch promised objects for collision check Patrick Steinhardt
2025-04-28 21:46 ` Junio C Hamano
2025-04-29 6:15 ` Patrick Steinhardt
2025-04-25 7:08 ` [PATCH v2 08/13] builtin/show-ref: don't fetch objects when printing refs Patrick Steinhardt
2025-04-28 21:50 ` Junio C Hamano
2025-04-25 7:09 ` [PATCH v2 09/13] refs: don't fetch promisor objects in `ref_resolves_to_object()` Patrick Steinhardt
2025-04-28 21:53 ` Junio C Hamano
2025-04-25 7:09 ` [PATCH v2 10/13] http-walker: don't fetch objects via promisor remotes Patrick Steinhardt
2025-04-28 21:56 ` Junio C Hamano
2025-04-25 7:09 ` [PATCH v2 11/13] list-objects: clarify how promised blobs are excluded Patrick Steinhardt
2025-04-25 7:09 ` [PATCH v2 12/13] bulk-checkin: don't fetch promised objects on write Patrick Steinhardt
2025-04-28 22:07 ` Junio C Hamano
2025-04-29 6:15 ` Patrick Steinhardt
2025-04-29 15:25 ` Junio C Hamano
2025-04-25 7:09 ` [PATCH v2 13/13] object-store: drop `repo_has_object_file()` Patrick Steinhardt
2025-04-28 19:49 ` [PATCH v2 00/13] object-store: a handful of cleanups Karthik Nayak
2025-04-29 7:52 ` [PATCH v3 0/7] " Patrick Steinhardt
2025-04-29 7:52 ` [PATCH v3 1/7] object-store: move `struct packed_git` into "packfile.h" Patrick Steinhardt
2025-04-29 7:52 ` [PATCH v3 2/7] object-store: drop `loose_object_path()` Patrick Steinhardt
2025-04-29 7:52 ` [PATCH v3 3/7] object-store: move and rename `odb_pack_keep()` Patrick Steinhardt
2025-04-29 7:52 ` [PATCH v3 4/7] object-store: move function declarations to their respective subsystems Patrick Steinhardt
2025-04-29 7:52 ` [PATCH v3 5/7] object-store: allow fetching objects via `has_object()` Patrick Steinhardt
2025-04-29 7:52 ` [PATCH v3 6/7] treewide: convert users of `repo_has_object_file()` to `has_object()` Patrick Steinhardt
2025-04-29 7:52 ` [PATCH v3 7/7] object-store: drop `repo_has_object_file()` Patrick Steinhardt
2025-04-29 20:07 ` [PATCH v3 0/7] object-store: a handful of cleanups 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=aAs0F58Hlpn6WI6b@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=karthik.188@gmail.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).