aboutsummaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorZheNing Hu <adlternative@gmail.com>2025-01-24 07:49:14 +0000
committerJunio C Hamano <gitster@pobox.com>2025-01-24 14:32:28 -0800
commit08032fa30fefa3101bec4b774e79f4d091b516a6 (patch)
tree6f65295cbde9d938e56d8ad94568dcb3becf18be /Documentation
parent92999a42db1c5f43f330e4f2bca4026b5b81576f (diff)
downloadgit-08032fa30fefa3101bec4b774e79f4d091b516a6.tar.xz
gc: add `--expire-to` option
This commit extends the functionality of `git gc` by adding a new option, `--expire-to=<dir>`. Previously, this feature was implemented in 91badeba32 (builtin/repack.c: implement `--expire-to` for storing pruned objects, 2022-10-24), which allowing users to specify a directory where unreachable and expired cruft packs are stored during garbage collection. However, users had to run `git repack --cruft --expire-to=<dir>` followed by `git prune` to achieve similar results within `git gc`. By introducing `--expire-to=<dir>` directly into `git gc`, we simplify the process for users who wish to manage their repository's cleanup more efficiently. This change involves passing the `--expire-to=<dir>` parameter through to `git repack`, making it easier for users to set up a backup location for cruft packs that will be pruned. Due to the original `git gc --prune=now` deleting all unreachable objects by passing the `-a` parameter to git repack. With the addition of the `--cruft` and `--expire-to` options, it is necessary to modify this default behavior: instead of deleting these unreachable objects, they should be merged into a cruft pack and collected in a specified directory. Therefore, we do not pass `-a` to the repack command but instead pass `--cruft`, `--expire-to`, and `--cruft-expiration=now` to repack. Signed-off-by: ZheNing Hu <adlternative@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/git-gc.txt7
1 files changed, 7 insertions, 0 deletions
diff --git a/Documentation/git-gc.txt b/Documentation/git-gc.txt
index 370e22faae..0eac8e85f0 100644
--- a/Documentation/git-gc.txt
+++ b/Documentation/git-gc.txt
@@ -69,6 +69,13 @@ be performed as well.
the `--max-cruft-size` option of linkgit:git-repack[1] for
more.
+--expire-to=<dir>::
+ When packing unreachable objects into a cruft pack, write a cruft
+ pack containing pruned objects (if any) to the directory `<dir>`.
+ This option only has an effect when used together with `--cruft`.
+ See the `--expire-to` option of linkgit:git-repack[1] for
+ more information.
+
--prune=<date>::
Prune loose objects older than date (default is 2 weeks ago,
overridable by the config variable `gc.pruneExpire`).