[GSoC PATCH v5 0/6] repack: add --drop-filtered to reclaim space in partial clones
- From
Siddharth Shrimali <r.siddharth.shrimali@gmail.com>
- Date
- Aug 13, 2026, 20:08 UTC
- Message-ID
- <20260813200830.84348-1-r.siddharth.shrimali@gmail.com>
- In-Reply-To
- <20260810174047.6524-1-r.siddharth.shrimali@gmail.com>
This is v5. v4 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. 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 v4:
* list-objects-filter: fixed the object-size local from "unsigned
long" to "size_t" to match object_info.sizep - caught by Junio
* list-objects-filter: made the filter options parameter const and
dropped the now-unnecessary cast at the call site - caught by Christian
* repack-filtered: comment fixes
* squashed the documentation into the patches it describes: the option
description now lands with "actually drop filtered promisor blobs"
and the guards paragraph with "add guards for --drop-filtered",
dropping the separate documentation patch, so the series is now 6
patches - Suggested by Christian
* improved the "operation in progress" error message to name the
operations (merge, rebase, am, cherry-pick, revert, or bisect)
* swept test comments to be proper sentences and fixed tab or space
indentationTo 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/20260810174047.6524-1-r.siddharth.shrimali@gmail.com/
Siddharth Shrimali (6):
builtin/repack: 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-filteredDocumentation/git-repack.adoc | 37 +++++++ builtin/repack.c | 154 +++++++++++++++++++++++++- 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, 536 insertions(+), 7 deletions(-) create mode 100755 t/t7706-repack-drop-filtered.sh
-- 2.54.0