Re: [BUG] push resends common history after repack during pre-push (2.54.0, 2.56.0)
- From
D. Ben Knoble <ben.knoble@gmail.com>
- Date
- Oct 6, 2026, 20:03 UTC
- Message-ID
- <CALnO6CAAGgKK=cQ6Gycn9Y4K7rW8_vxkzpgFUYQANY=yg3Y17A@mail.gmail.com>
- In-Reply-To
- <CA+tGzvYYKm=Yo88knZb4oavG9dH5smUCXnoqa-RR9-7YEBycVA@mail.gmail.com>
I'm out of my depth here, but maybe others will have the same question…
On Tue, Oct 6, 2026 at 1:39 PM Jens Röcker <jens.roecker@gmail.com> wrote:
Show 35 quoted lines
> > Hello Git developers, > > A push can resend common history if its pre-push hook repacks the local > object database and removes previously loose common objects. I reproduced > this with Apple Git 2.54.0 (Apple Git-157) and an unmodified build of the > current upstream Git 2.56.0 release on macOS 27.0 / arm64. > > The attached inline Python script creates fresh local repositories, seeds > a bare receiver with a deterministic, incompressible 4-MiB historical blob, > and pushes one tiny text-file commit. The common base is initially loose. > The receiver uses receive.unpackLimit=1 so the added pack is measurable. > Each case starts from a separate fresh repository pair. All pushes succeed > and the receiver ends at the expected tip. > > Observed added receiver pack sizes, in bytes: > > Apple Git 2.54.0 upstream Git 2.56.0 > no hook 300 300 > repack in pre-push 4,196,026 4,196,026 > repack + negotiate 4,196,026 4,196,026 > > The repacking hook is simply: > > #!/bin/sh > set -eu > cat >/dev/null > git repack -adq > git prune-packed > > Expected: the already-advertised common history should still be excluded > when its storage moves from loose objects to a newly created pack. > Actual: the historical blob is transmitted again. The receiver stores a > new pack roughly the size of the historical blob. Enabling > push.negotiate=true does not prevent the redundant transfer in this test.
…I've lost the main idea at this point. Is the problem that you see objects sent from pusher to receiver more than once because of the repack hook? Or something else?
-- D. Ben Knoble