Skip to content

Instantly share code, notes, and snippets.

@dbryson
Created September 30, 2008 05:44
Show Gist options
  • Save dbryson/13748 to your computer and use it in GitHub Desktop.
Save dbryson/13748 to your computer and use it in GitHub Desktop.
commit 9044ce7984fbb5d59e116dc0789b3222bd368a79
Author: David Bryson <david@statichacks.org>
Date: Mon Sep 29 22:37:03 2008 -0700
Use "git_config_string" to simplify "builtin-gc.c" code
where "prune_expire" is set
diff --git a/builtin-gc.c b/builtin-gc.c
index fac200e..6260652 100644
--- a/builtin-gc.c
+++ b/builtin-gc.c
@@ -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);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment