Just pass it on down to builtin/repack.

Signed-off-by: Nathaniel Filardo <nw...@cl.cam.ac.uk>
---
 Documentation/git-gc.txt | 4 ++++
 builtin/gc.c             | 5 +++++
 2 files changed, 9 insertions(+)

diff --git a/Documentation/git-gc.txt b/Documentation/git-gc.txt
index 247f765604..6f9f15ef19 100644
--- a/Documentation/git-gc.txt
+++ b/Documentation/git-gc.txt
@@ -77,6 +77,10 @@ be performed as well.
        `.keep` files are consolidated into a single pack. When this
        option is used, `gc.bigPackThreshold` is ignored.
 
+--assume-pack-keep-transitive::
+       Pass the `--assume-pack-keep-transitive` option to `git-repack`;
+       see linkgit:git-repack[1].
+
 AGGRESSIVE
 ----------
 
diff --git a/builtin/gc.c b/builtin/gc.c
index 8943bcc300..1b304631c5 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -525,6 +525,7 @@ static void gc_before_repack(void)
 int cmd_gc(int argc, const char **argv, const char *prefix)
 {
        int aggressive = 0;
+       int assume_pack_keep_transitive = 0;
        int auto_gc = 0;
        int quiet = 0;
        int force = 0;
@@ -547,6 +548,8 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
                           PARSE_OPT_NOCOMPLETE),
                OPT_BOOL(0, "keep-largest-pack", &keep_base_pack,
                         N_("repack all other packs except the largest pack")),
+               OPT_BOOL(0, "assume-pack-keep-transitive", 
&assume_pack_keep_transitive,
+                        N_("assume kept packs reference only kept packs")),
                OPT_END()
        };
 
@@ -585,6 +588,8 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
        }
        if (quiet)
                argv_array_push(&repack, "-q");
+       if (assume_pack_keep_transitive)
+               argv_array_push(&repack, "--assume-pack-keep-transitive");
 
        if (auto_gc) {
                /*
-- 
2.17.1

Reply via email to