[GSoC PATCH v3 0/7] repack: add --drop-filtered to reclaim space in partial clones
Siddharth Shrimali <[email protected]> Thu, 6 Aug 2026 16:51:55 +0530
| Newsgroups | org.kernel.vger.git |
|---|---|
| Message-ID | <[email protected]> |
This is v3 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. v2 was at [1].
Partial clones let you work with large repositories without downloading
every blob up front. Missing 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, so it is recoverable from the promisor
remote as long as the remote still has it, the same assumption the
rest of partial clone relies on
* 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
the 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). Dropped objects stay recoverable via lazy fetch, so these are
a convenience (avoid pointless re-fetch and a surprising mid-operation
fetch) rather than a correctness measure. Both are skipped for bare
repositories
Changes since v2:
* bitmap config: detect an explicit -b/--write-bitmap-index
with an option callback instead of a before/after snapshot, so an
explicit -b is always reported as a conflict, even when
repack.writeBitmaps is already true in config
* softened "guaranteed recoverable" to "recoverable as long as the
remote still has it"
* reframed the guards in the commit message and docs as a convenience
rather than a safety measure
To do:
* Remote verification: verifying against the remote awaits the "remote-object-info"
cat-file protocol command
* Recency: a "don't cull recently-fetched objects" rule as another
selection criterion alongside size
* Drop log: introduce with the error-path change that reads it.
[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 guards for --drop-filtered
Documentation/git-repack: document --drop-filtered and --dry-run
Documentation/git-repack.adoc | 37 +++++++
builtin/repack.c | 148 ++++++++++++++++++++++++-
list-objects-filter.c | 45 ++++++++
list-objects-filter.h | 16 +++
repack-filtered.c | 82 ++++++++++++++
repack-promisor.c | 15 ++-
repack.h | 8 +-
t/meson.build | 1 +
t/t7706-repack-drop-filtered.sh | 185 ++++++++++++++++++++++++++++++++
9 files changed, 531 insertions(+), 6 deletions(-)
create mode 100755 t/t7706-repack-drop-filtered.sh
--
2.54.0