gitproto: send empty pack on pack-less ref creates

main

Commit

Soph3mo ago

PushCommands sent ref create/update commands with no packfile, relying on the server tolerating a pack-less create. Some receive-pack implementations read a pack header for every non-delete command and fail with a truncated-pack error ("read packfile header: EOF") when the request body ends after the commands. This wedged batched bootstraps at the subsumed-branch finalize step.

Attach a valid empty packfile (12-byte header, zero objects, trailing checksum) whenever the request contains a non-delete command. Delete-only pushes stay pack-less, as git requires. The trailer follows the target's advertised object-format capability, so SHA-256 targets get a 32-byte trailer. The two possible empty packs are precomputed once at package load rather than per call.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com Entire-Checkpoint: 7dc6c9127e93