fangorn/ex_git_objectstore
public
fix: UploadPackV2 must not emit acks section when client sends done #37
Links
No links yet.
The bug
Real `git fetch` (v2.53) against production fails with:
``` fatal: expected ‘packfile’, received ‘acknowledgments’ ```
Root cause
Per git v2.53 `fetch-pack.c` line 1715-1723: when `send_fetch_request` writes `done\n` it returns `done_sent=1`, and the client state machine transitions directly from `FETCH_SEND_REQUEST` to `FETCH_GET_PACK` — BYPASSING `FETCH_PROCESS_ACKS`. `FETCH_GET_PACK` expects `[shallow-info] [wanted-refs] [packfile-uris] packfile` and rejects any leading acknowledgments section.
Our server was emitting `acknowledgments\n … \n ready\n` + delim + `packfile` whenever `done` was in the request. That breaks real git clients.
Why existing tests missed it
Every test that exercised `done` sent it with zero haves. The hephaestus trace showed 6 haves + `done` in round 4 — the actual failing path.
Fix
Branch `fix/upload-pack-v2-done-skip-acks`: when `done` is in the request, respond with `[shallow-info]` + `packfile` directly, no acks section.
Regression coverage
- State-machine test driving `UploadPackV2.feed` with `done + haves`; asserts first pkt-line is `packfile`.
- Real-git-client multi-round test seeding 300 side commits (> MAX_IN_VAIN=256) to force the negotiator to emit `done` alongside non-empty haves.
Also corrects three pre-existing unit/integration tests that baked in the wrong acks-after-done invariant.