Skip to content

Commit 4dbb468

Browse files
committed
fixup! gvfs-helper: create tool to fetch objects using the GVFS Protocol
The previous fixup for 84f0e60 (packfile: move packfile store into object source, 2026-01-09) was incorrect. That upstream commit moved the packfile store from being a single global store in `struct object_database` to being per-source in `struct odb_source`. The previous fixup adapted the `packfile_store_reprepare()` call by changing: the_repository->objects->packfiles to: the_repository->objects->sources->packfiles However, this only reprepares the packfile store of the *first* source in the linked list. This is incorrect because GVFS-helper writes downloaded objects to `gh_client__chosen_odb`, which is typically the shared cache alternate (configured via `gvfs.sharedCache`), not the primary .git/objects directory. When objects are downloaded into the shared cache but only the primary source's packfile store is reprepared, the newly created packfiles remain invisible to subsequent object lookups. This causes the object lookup code in odb.c to fall through to the expensive `gh_client__get_immediate()` path, re-fetching objects that were already successfully downloaded via the batched queue mechanism. The test t5793.3 "integration: fully implicit: diff 2 commits" caught this regression. It verifies that blob objects are fetched via the efficient batched queue path (`gh_client__queue_oid`) and NOT via the single-object immediate path (`gh_client__get_immediate`). With the broken fixup, objects were being fetched twice: once via the queue (correct), and then again via immediate fetch (incorrect) because the packfile store for the shared cache was never reprepared. Fix this by repreparing the packfile store of the actual chosen ODB where objects are written: gh_client__chosen_odb->packfiles This variable is guaranteed to be set before `gh_client__objects__receive_response()` is called, since all callers go through `gh_client__find_long_running_process()` which calls `gh_client__choose_odb()` first. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 1a4158b commit 4dbb468

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gvfs-helper-client.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ static int gh_client__objects__receive_response(
271271
}
272272

273273
if (ghc & GHC__CREATED__PACKFILE)
274-
packfile_store_reprepare(the_repository->objects->sources->packfiles);
274+
packfile_store_reprepare(gh_client__chosen_odb->packfiles);
275275

276276
*p_ghc = ghc;
277277
*p_nr_loose = nr_loose;

0 commit comments

Comments
 (0)