Repository navigation
Description
Note
This issue was drafted with AI assistance and reviewed and approved by a human before posting.
Problem
In v2.56.0.vfs.0.0, git fetch fails in a mounted VFS for Git enlistment when a fetched ref tip is not yet in the local object store.
Fetching commits and trees from cache server...Succeeded
remote: This repository requires the GVFS protocol (use "gvfs clone" or "scalar clone"). Install a compatible Git client from https://github.com/microsoft/git/releases
fatal: protocol error: bad pack header
The same command succeeds with v2.55.0.vfs.0.10 in the same enlistment.
The failure is most likely on branches that move faster than the cache server publishes prefetch packs. The new tip is then in no prefetch pack yet.
Telemetry for our repo over three days shows a high exit-128 rate for fetches on this build. Six machines ran 2.56.0.vfs.0.0. Of the 55 fetches, 40 failed. The most common build, 2.55.0.vfs.0.10, fails 5.9% of the time.
Reproduction
- Use a mounted VFS for Git enlistment (
core.virtualizeobjects=true, GVFS read-object hook installed). - Pick a remote branch whose tip is not in the local object store.
- Run
git fetch origin +refs/heads/<branch>:refs/remotes/origin/<branch>withv2.56.0.vfs.0.0.
Result: exit code 128 with the error above.
With v2.55.0.vfs.0.10 the same command exits 0.
Cause
check_exist_and_connected() in builtin/fetch.c calls odb_has_object(..., ODB_HAS_OBJECT_RECHECK_PACKED) on each ref tip. This call does not set ODB_HAS_OBJECT_FETCH_PROMISOR, so it sets OBJECT_INFO_SKIP_FETCH_OBJECT.
In do_oid_object_info_extended() in odb.c, the read-object hook call has an extra condition in v2.56.0.vfs.0.0:
/* v2.55.0.vfs.0.10 */
if (gvfs_virtualize_objects(odb->repo) && !tried_hook) {
/* v2.56.0.vfs.0.0 */
if (gvfs_virtualize_objects(odb->repo) && !tried_hook &&
!(flags & OBJECT_INFO_SKIP_FETCH_OBJECT)) {The condition was added on purpose. It comes from 37a046833bb, a fixup of "gvfs-helper: create tool to fetch objects using the GVFS Protocol". The fixup first appears in v2.56.0-rc0.vfs.0.0. The fixup message says a no-fetch request must also apply to the read-object hook. The goal is to stop a no-fetch lookup from downloading an object after local recovery.
The side effect is in the fetch path:
- The hook does not run for a missing ref tip.
odb_has_object()returns false.check_exist_and_connected()returns -1, so git runsfetch-packagainst the server.- The server rejects the request, because it requires the GVFS protocol.
Before the change, the hook downloaded the tip. check_connected() then returned early because of GVFS_FETCH_SKIP_REACHABILITY_AND_UPLOADPACK, and git did not run upload-pack.
Evidence
Trace2 (GIT_TRACE2_EVENT) for the same fetch in the same enlistment:
| Version | Events after fetch/remote_refs |
|---|---|
v2.55.0.vfs.0.10 |
subprocess/read_object (starts read-object.exe), then fetch/consume_refs |
v2.56.0.vfs.0.0 |
fetch/fetch_refs, then git fetch-pack --stateless-rpc against the server. No read_object event. |
Workaround
Use v2.55.0.vfs.0.10. Alternatively, run gvfs prefetch --commits after the cache server publishes a pack that contains the tip, then fetch again.
Possible fixes
The fix must keep the intent of 37a046833bb: a general no-fetch lookup must not download objects. Two options:
- In
check_exist_and_connected(), whencore.virtualizeobjectsorGVFS_FETCH_SKIP_REACHABILITY_AND_UPLOADPACKis set, let the ref-tip check use the read-object hook. For example, passODB_HAS_OBJECT_FETCH_PROMISORfor that call. - Skip the tip-exists check in
check_exist_and_connected()under those settings and letcheck_connected()return early as before.
Both options need a regression test: fetch a ref whose tip is not local, with core.virtualizeobjects and a read-object hook, and check that fetch-pack does not run.
Activity
tyrielv commentedon Oct 12, 2026
Johannes Schindelin (@dscho) It looks like you intentionally made this change in commit 37a046833bb during the v2.56.0-rc0 rebase. How do you think we should address this? It sounds like your change was intended to block downloading objects during a "no-fetch" request, but this is also blocking downloading objects during an explicit "git fetch"
odb: run read-object hook during existence rechecks
fix v2.56.0.vfs.0.0 "requires the GVFS protocol" regression when ref …
dscho commentedon Oct 20, 2026
Fixed via #1005
dscho commentedon Oct 23, 2026
Tyrie Vella (@tyrielv) thank you for spelunking and digging up 37a0468.
For historical context: That
fixup!tried to address a stale multi-pack-index pointing to a removed pack: the no-fetch shortcut skipped the second local read, incorrectly reporting an object missing despite another readable packed copy. I changed it to skip onlygvfs-helper, retaining local recovery and corruption reporting. I also blocked theread-objecthook so missing-object enumeration would not download objects. Tests covered local recovery and missing/corrupt parents, but crucially not explicit fetch.All of this was triggered by
GIT_TEST_COMMIT_GRAPH=1breakingt0499during the rebase. The graph retained the removed parent’s topology, bypassing the intended object lookup.