Merge branch 'jk/diff-files-assume-unchanged' into maint
[gitweb.git] / builtin / gc.c
index 11cf295515a25b1df19af7a14c2cd03911d957b5..85f5c2bc62ec1ead593f5aa2e3d7077e65f2f061 100644 (file)
@@ -26,6 +26,7 @@ static const char * const builtin_gc_usage[] = {
 };
 
 static int pack_refs = 1;
+static int aggressive_depth = 250;
 static int aggressive_window = 250;
 static int gc_auto_threshold = 6700;
 static int gc_auto_pack_limit = 50;
@@ -66,6 +67,10 @@ static int gc_config(const char *var, const char *value, void *cb)
                aggressive_window = git_config_int(var, value);
                return 0;
        }
+       if (!strcmp(var, "gc.aggressivedepth")) {
+               aggressive_depth = git_config_int(var, value);
+               return 0;
+       }
        if (!strcmp(var, "gc.auto")) {
                gc_auto_threshold = git_config_int(var, value);
                return 0;
@@ -294,7 +299,8 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
 
        if (aggressive) {
                argv_array_push(&repack, "-f");
-               argv_array_push(&repack, "--depth=250");
+               if (aggressive_depth > 0)
+                       argv_array_pushf(&repack, "--depth=%d", aggressive_depth);
                if (aggressive_window > 0)
                        argv_array_pushf(&repack, "--window=%d", aggressive_window);
        }