path: root/Documentation/git-repack.txt
diff options
authorNguyễn Thái Ngọc Duy <>2018-04-15 15:36:13 (GMT)
committerJunio C Hamano <>2018-04-16 04:52:29 (GMT)
commited7e5fc3a2562e3d4fb4fe25e8dca0e9daa0ed13 (patch)
treef9dc45a7c7e520859d47a8fc0052cb50432e6050 /Documentation/git-repack.txt
parente9e33ab0fba44c2680f5461cdc774c88b3bf4ac1 (diff)
repack: add --keep-pack option
We allow to keep existing packs by having companion .keep files. This is helpful when a pack is permanently kept. In the next patch, git-gc just wants to keep a pack temporarily, for one pack-objects run. git-gc can use --keep-pack for this use case. A note about why the pack_keep field cannot be reused and pack_keep_in_core has to be added. This is about the case when --keep-pack is specified together with either --keep-unreachable or --unpack-unreachable, but --honor-pack-keep is NOT specified. In this case, we want to exclude objects from the packs specified on command line, not from ones with .keep files. If only one bit flag is used, we have to clear pack_keep on pack files with the .keep file. But we can't make any assumption about unreachable objects in .keep packs. If "pack_keep" field is false for .keep packs, we could potentially pull lots of unreachable objects into the new pack, or unpack them loose. The safer approach is ignore all packs with either .keep file or --keep-pack. Signed-off-by: Nguyễn Thái Ngọc Duy <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'Documentation/git-repack.txt')
1 files changed, 8 insertions, 1 deletions
diff --git a/Documentation/git-repack.txt b/Documentation/git-repack.txt
index ae750e9..ce497d9 100644
--- a/Documentation/git-repack.txt
+++ b/Documentation/git-repack.txt
@@ -9,7 +9,7 @@ git-repack - Pack unpacked objects in a repository
-'git repack' [-a] [-A] [-d] [-f] [-F] [-l] [-n] [-q] [-b] [--window=<n>] [--depth=<n>] [--threads=<n>]
+'git repack' [-a] [-A] [-d] [-f] [-F] [-l] [-n] [-q] [-b] [--window=<n>] [--depth=<n>] [--threads=<n>] [--keep-pack=<pack-name>]
@@ -133,6 +133,13 @@ other objects in that pack they already have locally.
with `-b` or `repack.writeBitmaps`, as it ensures that the
bitmapped packfile has the necessary objects.
+ Exclude the given pack from repacking. This is the equivalent
+ of having `.keep` file on the pack. `<pack-name>` is the the
+ pack file name without leading directory (e.g. `pack-123.pack`).
+ The option could be specified multiple times to keep multiple
+ packs.
When loosening unreachable objects, do not bother loosening any
objects older than `<when>`. This can be used to optimize out