From: Marc Strapetz Date: Mon, 26 Oct 2026 21:23:46 GMT Subject: Re: [PATCH 0/3] send-pack: avoid resending unchanged objects after rebasing Message-ID: <729930b3-1be6-4612-823c-55cb20d555b8@syntevo.com> In-Reply-To: On 26/10/2026 18:26, Junio C Hamano wrote: > This sounds like the exact problem push negotiation was designed to > address. Thanks for pointing this out. This series aims to optimize Git's default packing for forced non-fast-forward updates, without adding a negotiation phase. I should have explained that scope more clearly in the cover letter: `pack-objects` can resend unchanged objects from an advertised old branch tip even though `send-pack` already supplies that tip as an exclusion. This series improves default packing for forced updates by applying the existing sparse tree marking to selected old tips. It targets this inefficiency without the additional negotiation exchanges of `push.negotiate` or the broader recursive tree marking of `--objects-edge-aggressive`. Neither is enabled by default for ordinary pushes from non-shallow repositories. This series targets a narrower opportunity within that default behavior. A divergent old tip can lie outside the boundary reached by the ordinary revision walk. Passing it to `pack-objects` as `--inspect-have` lets us compare its root tree with the outgoing trees, pruning identical and receiver-only subtrees. The additional inspection is limited to forced non-fast-forward updates of existing branches with locally available old tips. Large blobs retained across a rebase are a particularly costly example of the redundant transfer this avoids. I would also add the following section at the end to explain how this relates to the existing optimizations: `push.negotiate` discovers additional common commits through a separate fetch negotiation, potentially requiring multiple protocol round trips. This can reduce the pack when ref advertisement alone is insufficient, but adds latency even when the advertised tips already suffice. For small pushes that latency can outweigh the transfer savings. Even if negotiation achieves the same pack-size reduction, improving the default packing path avoids the need to pay that additional protocol cost. `--objects-edge-aggressive` already considers excluded tips beyond the ordinary walk's boundary, but recursively marks their trees. The decision to enable it automatically only for shallow pushes was made for performance reasons: the 2014 series [1] records a regression from 4.785 to 23.322 seconds with 22,400 refs [2], and keeps non-shallow repositories on `--objects-edge` for better performance in the general case [3]. This series instead limits inspection to the old tips of branches being forcibly updated and uses sparse comparison to prune identical and receiver-only subtrees. The additional inspection requires no protocol exchange or walk of the old tip's commit history. Ordinary fast-forward pushes keep their existing path, including those made with `--force`. No server or wire-protocol change is needed. [1] https://lore.kernel.org/git/1419462340-769147-3-git-send-email-sandals@crustytoothpaste.net/T/ [2] https://github.com/git/git/commit/1684c1b219e02c91655ad929f752f4f864c72faf [3] https://github.com/git/git/commit/2dacf26d0985521c0f30e535963a45257b63ea21