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

Siddharth Shrimali <[email protected]>
Newsgroups org.kernel.vger.git
Message-ID <[email protected]>
This is v4. v3 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 v3:
  * fixed the git repack -h usage string to include --drop-filtered and
    --dry-run, so it matches the SYNOPSIS in the documentation (t0450
    was failing - caught by Junio)
  * converted a bare grep in the test to test_grep (test-lint error -
    caught by Junio)
  * removed a stray bracket in the documentation SYNOPSIS

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                | 151 +++++++++++++++++++++++++-
 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, 533 insertions(+), 7 deletions(-)
 create mode 100755 t/t7706-repack-drop-filtered.sh

-- 
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.