Re: [External] [RFC PATCH resend] builtin/repack: Honor --keep-pack and .keep when repacking promisor objects
- From
Han Young <hanyang.tony@bytedance.com>
- Date
- Feb 10, 2025, 11:38 UTC
- Message-ID
- <CAG1j3zH1xngk0NZUjHA9Akx526yfEiQ=KsdfyRjE9XAewWV=Sg@mail.gmail.com>
- In-Reply-To
- <2728513.vuYhMxLoTh@mintaka.ncbr.muni.cz>
On Wed, Jan 29, 2025 at 6:12 PM Tomáš Trnka <trnka@scm.com> wrote:
Show 9 quoted lines
> > git-repack currently does not pass --keep-pack or --honor-pack-keep to > the git-pack-objects handling promisor packs. This means that settings > like gc.bigPackThreshold are completely ignored for promisor packs. > > The simple fix is to just copy the keep-pack logic into > repack_promisor_objects(), although this could possibly be improved by > making prepare_pack_objects() handle it instead. >
We repack promisor packs by reading all the objects in promisor packs (in repack.c), and send them to pack-objects. pack-objects then write a single pack containing all the promisor objects. The actual old promisor pack deletion happens in repack.c
So just simply copying the keep-pack logic to repack_promisor_objects() does not prevent the keep promisor packs from being repacked.
One way to achieve what you wanted would be to filter the keep packs in repack_promisor_objects's for_each_packed_object().
Thanks.