Documentation/git-repack: document --drop-filtered and --dry-run

Describe the new --drop-filtered and --dry-run options: what they do,
only blob:limit filters are supported for now, a promisor remote is
required, --drop-filtered requires -a and implies -d so the redundant
packs are actually removed, its incompatibilities with --filter-to and
bitmap writing, and the safety guards that refuse to run mid-operation
or to drop index-referenced blobs.

Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Siddharth Asthana <siddharthasthana31@gmail.com>
Signed-off-by: Siddharth Shrimali <r.siddharth.shrimali@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Siddharth Shrimali
2026-08-06 16:52:02 +05:30
committed by Junio C Hamano
parent a0478d439a
commit 7e4c047af9

View File

@@ -12,6 +12,7 @@ SYNOPSIS
'git repack' [-a] [-A] [-d] [-f] [-F] [-l] [-n] [-q] [-b] [-m]
[--window=<n>] [--depth=<n>] [--threads=<n>] [--keep-pack=<pack-name>]
[--write-midx[=<mode>]] [--name-hash-version=<n>] [--path-walk]
[--filter=<filter-spec>] [--drop-filtered [--dry-run]]]
DESCRIPTION
-----------
@@ -182,6 +183,42 @@ depth is 4095.
`objects` and `objects/info/alternates` sections of
linkgit:gitrepository-layout[5].
--drop-filtered::
Delete the local objects that match the `--filter` specification
instead of keeping them in a separate packfile, reclaiming the
disk space they occupy. This is intended for partial clones,
where the filtered objects are promisor objects that remain
recoverable from the promisor remote and are lazily re-fetched
on demand when they are next needed.
+
Only large blobs are supported for now, so `--filter=blob:limit=<n>`
is currently the only accepted filter. Because dropped objects must be
recoverable, this option requires a promisor remote to be configured
and refuses to run otherwise.
+
This option requires `-a`, and implies `-d`: the objects are dropped by
rebuilding the promisor pack without them and then removing the now
redundant old packs, so the redundant packs must be deleted for the
space to actually be reclaimed. It is incompatible with `--filter-to`
and with bitmap writing (`-b`/`--write-bitmap-index`), since filtering
breaks the single-pack closure that bitmaps require. A bitmap setting
coming from configuration is silently disabled for the duration of the
command.
+
As a convenience since dropped objects remain recoverable by lazy fetch,
`--drop-filtered` refuses to run while another operation
(merge, rebase, am, cherry-pick, revert, or bisect) is in progress, to
avoid a surprising network fetch mid-operation, and refuses to drop any
blob that the current index references, since such a blob would only be
lazily re-fetched by the next command that inspects the working tree.
These checks are skipped in bare repositories, which have neither a
working tree nor an index.
--dry-run::
Only meaningful with `--drop-filtered`. List the objects that
would be dropped, one object ID per line, without rebuilding any
pack or deleting anything.
-b::
--write-bitmap-index::
Write a reachability bitmap index as part of the repack. This