Skip to content

Commit

Permalink
Use "git_config_string" to simplify "builtin-gc.c" code where "prune_…
Browse files Browse the repository at this point in the history
…expire" is set

Signed-off-by: David Bryson <david@statichacks.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  • Loading branch information
David Bryson authored and Shawn O. Pearce committed Sep 30, 2008
1 parent 8753941 commit d3154b4
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions builtin-gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit d3154b4

Please sign in to comment.