Re: [PATCH 0/4] send-pack: introduce a `no-ref-delta` capability
- From
Taylor Blau <ttaylorr@openai.com>
- Date
- Jul 14, 2026, 21:58 UTC
- Message-ID
- <alaxDPps6mg32C0g@com-79390>
- In-Reply-To
- <20260714074506.GD4058320@coredump.intra.peff.net>
On Tue, Jul 14, 2026 at 03:45:06AM -0400, Jeff King wrote:
Show 17 quoted lines
> On Sun, Jul 12, 2026 at 06:11:47PM -0700, Taylor Blau wrote: > > > Some 'receive-pack' implementations may wish to retain the incoming pack > > without first building an object ID index, in which case requiring delta > > bases to appear earlier in the same pack makes them easier to locate. > > This explanation puzzles me. OK, I can see why you might want to take in > the incoming pack and then sit on it for a bit. But surely you are not > going to update refs without seeing what's in the pack, right? Otherwise > any pushing client can corrupt your repo. > > And the only way to know what's in the pack is to index it. At which > point resolving REF_DELTAs is the least of your worries there. > > So I have the feeling that there's some ulterior motive, or that this is > part of a larger system, but I don't quite understand what it is. And so > it's hard to say whether this is a sensible approach.
The implementation motivating this is write-through in the sense that it first parses and spools the incoming pack, then replays those exact bytes together with the same ref commands to an upstream receive-pack.
The packfile contents and pending transaction may be staged before that upstream request finishes, but no local ref update is published unless the upstream accepts the push. So the usual receive-pack connectivity checks still happen before the update becomes visible locally.
(Apologies for all of the hand-waving here, BTW. I'm trying to describe the system in generic terms to make clear my motivations here, but I am somewhat limited in what I can discuss.)
In retrospect, I don't think the cover letter distinguishes this well. The pack that we receive over the wire is stored byte-for-byte as an immutable artifact, and the per-object physical index is derived asynchronously. That indexer is designed to operate in a single pass forward over the pack.
(Supporting REF_DELTA there during the indexing process is possible in theory, but requires keeping an OID lookup around, delaying resolution, taking another pass, or rewriting the retained pack. This design avoids all of those.)
Show 8 quoted lines
> > Bitmap pack reuse is different, since it copies entries directly from > > an existing pack. Under `--no-ref-delta`, it must inspect candidate > > objects individually, omit `REF_DELTA` entries from direct pack reuse, > > and leave them to the normal object-writing path. > > Hmm. We wouldn't normally expect verbatim pack-reuse to kick in, since > this is about the client sending to the server. But OK, we certainly > need to make sure that path remains correct.
That is an edge case rather than part of the motivation. It is only there so that `pack-objects --no-ref-delta` means what it says even if/when it performs verbatim pack-reuse.
Show 13 quoted lines
> > - The final patch advertises and consumes the new `no-ref-delta` > > capability. > > What about thin packs? They'll result in REF_DELTAs on the server once > the pack is completed/indexed. I guess we have the "no-thin" capability, > but I don't think our receive-pack implementation support sending it. I > also wouldn't be terribly surprised if not every client implementation > supports it (it was added in 2013 I think to support libgit2). But I > guess that is also true of your new no-ref-delta; only updated clients > will respect it. > > What will/should a server do when they get a ref delta anyway? That > again goes back to the question of: why don't we want ref deltas?
The implementation in question already advertises 'no-thin',
A sender honoring `no-ref-delta` cannot send a thin pack in the first place, since an external base must be encoded as REF_DELTA. `send-pack` may still invoke `pack-objects` with both `--thin` and `--no-ref-delta`, but the latter causes it to skip excluded bases.
Older clients may ignore `no-ref-delta` and still get rejected. That is already the receiver's behavior. The capability just lets updated clients avoid sending a pack which will be rejected.
If a REF_DELTA arrives anyway, the receiver rejects the pack before publishing the ref.
Thanks, Taylor