X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-gc.c;h=7af65bb31bfbf3e9a0e47901d44168389d736d20;hb=aebd173ffa7a4e67447f0157a14abde7767c54e9;hp=fac200e0b08360625afc81b02913128c9b87f486;hpb=1f8dc671557a7330eaee9c0296bfad669d26a1b8;p=git.git diff --git a/builtin-gc.c b/builtin-gc.c index fac200e0b..7af65bb31 100644 --- a/builtin-gc.c +++ b/builtin-gc.c @@ -26,7 +26,7 @@ static int pack_refs = 1; static int aggressive_window = -1; static int gc_auto_threshold = 6700; static int gc_auto_pack_limit = 50; -static char *prune_expire = "2.weeks.ago"; +static const char *prune_expire = "2.weeks.ago"; #define MAX_ADD 10 static const char *argv_pack_refs[] = {"pack-refs", "--all", "--prune", NULL}; @@ -57,15 +57,12 @@ static int gc_config(const char *var, const char *value, void *cb) return 0; } if (!strcmp(var, "gc.pruneexpire")) { - if (!value) - return config_error_nonbool(var); - if (strcmp(value, "now")) { + if (value && strcmp(value, "now")) { unsigned long now = approxidate("now"); if (approxidate(value) >= now) return error("Invalid %s: '%s'", var, value); } - prune_expire = xstrdup(value); - return 0; + return git_config_string(&prune_expire, var, value); } return git_default_config(var, value, cb); }