Just pass it on down to builtin/repack.

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

diff --git a/Documentation/git-gc.txt b/Documentation/git-gc.txt
index a7c1b0f60e..7115564f7d 100644
--- a/Documentation/git-gc.txt
+++ b/Documentation/git-gc.txt
@@ -96,6 +96,11 @@ 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].
+
+
 CONFIGURATION
 -------------
 
diff --git a/builtin/gc.c b/builtin/gc.c
index 020f725acc..b0c160abec 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -504,6 +504,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;
@@ -526,6 +527,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()
        };
 
@@ -564,6 +567,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