Re: [GSoC PATCH v2 0/7] repack: add --drop-filtered to reclaim space in partial clones

Siddharth Asthana <[email protected]> Wed, 5 Aug 2026 02:42:03 +0530
Newsgroups org.kernel.vger.git
Message-ID <[email protected]>

On 30/07/26 23:11, Siddharth Shrimali wrote:
> This is v2 of the series adding "git repack --drop-filtered" to reclaim
> disk space in partial clones by dropping large, locally-held promisor
> blobs that remain recoverable from the promisor remote. v1 was sent as
> an RFC [1].
> 
> Partial clones let you work with large repositories without downloading
> every blob up front. Mising blobs are lazily fetched from the promisor
> remote on demand. Over time these accumulate locally and there is
> currently no safe, built-in way to reclaim that space short of
> re-cloning. This series adds that reverse direction: enumerate promisor
> blobs over a size threshold, drop them locally, and rely on the existing
> lazy-fetch machinery to bring them back transparently when needed.
> 
> How it works:
>    * Enumerate promisor objects directly (ODB_FOR_EACH_OBJECT_PROMISOR_ONLY)
>      and select the blobs exceeding the filter threshold. Every enumerated
>      object is a promisor object by construction, so it is guaranteed
>      recoverable and locally-created objects are never candidates.



Thanks for v2. Guards, docs, and dropping the drop-log all match what we 
have talked about on the RFC.

On "guaranteed": I would soften that a bit in next round. It is 
recoverable in the same sense as the rest of partial clone, as long as 
the promisor remote still has it. Fine for now, just a bit strong
without a remote check.

For the promisor-only walk: that matches how we already treat those
objects, so using it here looks right to me.

On the guards you already covered Junio's point well. I still like the
index one so we do not drop something and fetch it straight back. Mid-op
is more UX. Docs/cover can just say that clearly.

Thanks.
Siddharth


>    * Rebuild the promisor pack without the selected blobs, reusing the
>      existing repack machinery, so the drop is crash-safe (write, fsync,
>      install, then delete the old pack).
>    * --dry-run lists the candidates and changes nothing.
> 
> Safety guards refuse to run while a merge, rebase, am, cherry-pick,
> revert, or bisect is in progress, and refuse to drop a blob referenced
> by the current index (it would only be lazily re-fetched by the next
> worktree command). Both are skipped for bare repositories.
> 
> Changes since v1:
>    * distinguish an explicit -b/--write-bitmap-index on the command line
>      (reported as a conflict) from a repack.writeBitmaps config value
>      (silently disabled for the command). This addresses Junio's review
>      that the previous check could not tell the two apart
>    * documented the choice to keep --dry-run as a separate option rather
>      than --drop-filtered=<mode>
>    * implemented the safety guards
>    * Added git-repack documentation for --drop-filtered and --dry-run
>    * Reorganised so enumerate_promisor_blobs() is introduced in its final
>      signature
>    * Distributed the tests into the commits that introduce each behavior,
>      instead of a single standalone test commit.
>    * Dropped the drop-log commit from this series
> 
> To do:
>    * Remote verification: verifying against the remote awaits the "remote-object-info"
>      cat-file protocol command.
>    * Drop log: introduce with the error-path change that reads it.
>    * --verbose: space-reclaimed reporting.
> 
> [1] https://lore.kernel.org/git/[email protected]/
> 
> Siddharth Shrimali (7):
>    builtin/repack.c: add --drop-filtered and --dry-run options
>    list-objects-filter: add list_objects_filter__filter_oidset()
>    repack-promisor: allow excluding objects from the rebuilt promisor
>      pack
>    builtin/repack: enumerate promisor blobs for --drop-filtered
>    builtin/repack: actually drop filtered promisor blobs
>    builtin/repack: add safety guards for --drop-filtered
>    Documentation/git-repack: document --drop-filtered and --dry-run
> 
>   Documentation/git-repack.adoc   |  35 +++++++
>   builtin/repack.c                | 135 +++++++++++++++++++++++-
>   list-objects-filter.c           |  45 ++++++++
>   list-objects-filter.h           |  16 +++
>   repack-filtered.c               |  81 +++++++++++++++
>   repack-promisor.c               |  15 ++-
>   repack.h                        |   8 +-
>   t/meson.build                   |   1 +
>   t/t7706-repack-drop-filtered.sh | 179 ++++++++++++++++++++++++++++++++
>   9 files changed, 511 insertions(+), 4 deletions(-)
>   create mode 100755 t/t7706-repack-drop-filtered.sh
>