From: Patrick Steinhardt Date: Wed, 23 Apr 2025 07:48:18 GMT Subject: [PATCH 08/13] builtin/show-ref: don't fetch objects when printing refs Message-ID: <20250423-pks-object-store-cleanups-v1-8-81f8411a5d08@pks.im> In-Reply-To: <20250423-pks-object-store-cleanups-v1-0-81f8411a5d08@pks.im> When printing references via git-show-ref(1) we double check that their respective object IDs point to an existing object. This check is performed via `repo_has_object_file()`, which knows to fetch missing promised objects in the background. We shouldn't have a need to fetch such objects though as no reference should ever point to a missing object at all. Convert the callsite to `has_object()`, which doesn't fetch promisor objects by default. Signed-off-by: Patrick Steinhardt --- builtin/show-ref.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/show-ref.c b/builtin/show-ref.c index f81209f23c3..fe592b4c202 100644 --- a/builtin/show-ref.c +++ b/builtin/show-ref.c @@ -35,7 +35,7 @@ static void show_one(const struct show_one_options *opts, const char *hex; struct object_id peeled; - if (!repo_has_object_file(the_repository, oid)) + if (!has_object(the_repository, oid, HAS_OBJECT_RECHECK_PACKED)) die("git show-ref: bad ref %s (%s)", refname, oid_to_hex(oid)); -- 2.49.0.901.g37484f566f.dirty