Use "git_config_string" to simplify "builtin-gc.c" code where "prune_expire" is set
Signed-off-by: David Bryson <david@statichacks.org> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
David Bryson committed
Sep 30, 2008 at 13:28 UTC
d3154b44c28affc94a4fbaf26706f075b58733a7
1 file changed
+3
-6
builtin-gc.c
+3
-6
@@ -26,7 +26,7 @@ static int pack_refs = 1;
26
static int aggressive_window = -1;
27
static int gc_auto_threshold = 6700;
28
static int gc_auto_pack_limit = 50;
29
-static char *prune_expire = "2.weeks.ago";
29
+static const char *prune_expire = "2.weeks.ago";
30
31
#define MAX_ADD 10
32
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)
57
return 0;
58
}
59
if (!strcmp(var, "gc.pruneexpire")) {
60
- if (!value)
61
- return config_error_nonbool(var);
62
- if (strcmp(value, "now")) {
60
+ if (value && strcmp(value, "now")) {
61
unsigned long now = approxidate("now");
62
if (approxidate(value) >= now)
63
return error("Invalid %s: '%s'", var, value);
64
}
67
- prune_expire = xstrdup(value);
68
- return 0;
65
+ return git_config_string(&prune_expire, var, value);
66
}
67
return git_default_config(var, value, cb);
68
}