Git development
 help / color / mirror / Atom feed
From: Taylor Blau <ttaylorr@openai.com>
To: git@vger.kernel.org, git@vger.kernel.org
Cc: Jeff King <peff@peff.net>, Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 0/4] send-pack: introduce a `no-ref-delta` capability
Date: Sun, 12 Jul 2026 18:11:47 -0700	[thread overview]
Message-ID: <alQ7U8TOWjhasaWk@com-79390> (raw)

This series teaches 'send-pack' to avoid writing `REF_DELTA` entries
when the receiving end asks it to.

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.

The new `no-ref-delta` capability is deliberately independent of
`ofs-delta`, and thus asking the sender not to write `REF_DELTA` entries
does not by itself mean that the receiver understands `OFS_DELTA`
entries. The corresponding `pack-objects` option therefore controls
`REF_DELTA` without changing whether `OFS_DELTA` is allowed.

The main complication is reuse. Ordinary delta reuse reuses the
compressed delta instructions, but rewrites the entry header and base
reference. It can therefore write an existing `REF_DELTA` as an
`OFS_DELTA` when `--delta-base-offset` is in effect and the base has
already been written in the output pack. Deltas against preferred or
external thin-pack bases cannot be reused in this way, since those bases
do not appear in the output at all.

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.

The patches are organized as follows:

 - The first patch teaches 'test-tool pack-deltas' to list each delta's
   representation and base. I originally wrote the series without this,
   but found that writing tests demonstrating which specific *kind* of
   delta representation was chosen to be awkward without having a
   dedicated test helper.

 - The second patch introduces the `--no-ref-delta` option in
   'pack-objects', though initially with delta- and bitmap-reuse
   disabled for the sake of simplicity.

 - The third patch re-enables ordinary delta- and bitmap-reuse where it
   is safe to do so.

 - The final patch advertises and consumes the new `no-ref-delta`
   capability.

Thanks in advance for your review!

Taylor Blau (4):
  t/helper: teach pack-deltas to list delta entries
  pack-objects: introduce `--no-ref-delta`
  pack-objects: support reuse with `--no-ref-delta`
  send-pack: honor `no-ref-delta` capability

 Documentation/git-pack-objects.adoc         |  8 ++-
 Documentation/gitprotocol-capabilities.adoc | 17 ++++-
 builtin/pack-objects.c                      | 29 ++++++--
 builtin/receive-pack.c                      |  5 ++
 pack-bitmap.c                               | 30 +++++---
 pack-bitmap.h                               |  3 +-
 send-pack.c                                 |  4 ++
 send-pack.h                                 |  1 +
 t/helper/test-pack-deltas.c                 | 69 ++++++++++++++++++
 t/t5300-pack-object.sh                      | 79 ++++++++++++++++++++-
 t/t5332-multi-pack-reuse.sh                 | 16 +++++
 t/t5516-fetch-push.sh                       | 14 ++++
 12 files changed, 252 insertions(+), 23 deletions(-)

-- 
2.55.0

             reply	other threads:[~2026-07-13  1:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-13  1:11 Taylor Blau [this message]
2026-07-13  1:14 ` [PATCH 0/4] send-pack: introduce a `no-ref-delta` capability Taylor Blau
2026-07-14  7:45 ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alQ7U8TOWjhasaWk@com-79390 \
    --to=ttaylorr@openai.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox