diff options
| author | Patrick Steinhardt <ps@pks.im> | 2025-04-29 09:52:19 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-04-29 10:08:13 -0700 |
| commit | f8fc4cacd37afa254a8822258f76de53ae2dfbb2 (patch) | |
| tree | 9af99cedd8587e19db6d968bb19ac996b8078456 /object-store.c | |
| parent | 1a793261c53507f7c46f748cc76378a9c5bb05cf (diff) | |
| download | git-f8fc4cacd37afa254a8822258f76de53ae2dfbb2.tar.xz | |
object-store: allow fetching objects via `has_object()`
We're about to fully remove `repo_has_object_file()` in favor of
`has_object()`. The latter function does not yet have a way to fetch
missing objects via a promisor remote though, which means that it cannot
fully replace all usecases of `repo_has_object_file()`.
Introduce a new flag `HAS_OBJECT_FETCH_PROMISOR` that causes the
function to optionally fetch missing objects which are part of a
promisor pack. This flag will be used in the subsequent commit.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'object-store.c')
| -rw-r--r-- | object-store.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/object-store.c b/object-store.c index 0cbad5a19a..0d873868a6 100644 --- a/object-store.c +++ b/object-store.c @@ -937,12 +937,15 @@ void *read_object_with_reference(struct repository *r, int has_object(struct repository *r, const struct object_id *oid, unsigned flags) { - int quick = !(flags & HAS_OBJECT_RECHECK_PACKED); - unsigned object_info_flags = OBJECT_INFO_SKIP_FETCH_OBJECT | - (quick ? OBJECT_INFO_QUICK : 0); + unsigned object_info_flags = 0; if (!startup_info->have_repository) return 0; + if (!(flags & HAS_OBJECT_RECHECK_PACKED)) + object_info_flags |= OBJECT_INFO_QUICK; + if (!(flags & HAS_OBJECT_FETCH_PROMISOR)) + object_info_flags |= OBJECT_INFO_SKIP_FETCH_OBJECT; + return oid_object_info_extended(r, oid, NULL, object_info_flags) >= 0; } |
