summaryrefslogtreecommitdiff
path: root/builtin/gc.c
diff options
context:
space:
mode:
authorChristian Couder <christian.couder@gmail.com>2017-02-27 18:00:13 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-03-01 21:34:54 (GMT)
commit77d67977cac46aa6c07c66ce9e2470f00feb9d20 (patch)
tree580440bf17327f2d08c337d6f05cbb0836895c26 /builtin/gc.c
parent0d59ffb47ed58f519bfa2796d38364496735ab19 (diff)
downloadgit-77d67977cac46aa6c07c66ce9e2470f00feb9d20.zip
git-77d67977cac46aa6c07c66ce9e2470f00feb9d20.tar.gz
git-77d67977cac46aa6c07c66ce9e2470f00feb9d20.tar.bz2
config: add git_config_get_expiry() from gc.c
This function will be used in a following commit to get the expiration time of the shared index files from the config, and it is generic enough to be put in "config.c". Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/gc.c')
-rw-r--r--builtin/gc.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/builtin/gc.c b/builtin/gc.c
index 069950d..1e40d45 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -62,17 +62,6 @@ static void report_pack_garbage(unsigned seen_bits, const char *path)
string_list_append(&pack_garbage, path);
}
-static void git_config_date_string(const char *key, const char **output)
-{
- if (git_config_get_string_const(key, output))
- return;
- if (strcmp(*output, "now")) {
- unsigned long now = approxidate("now");
- if (approxidate(*output) >= now)
- git_die_config(key, _("Invalid %s: '%s'"), key, *output);
- }
-}
-
static void process_log_file(void)
{
struct stat st;
@@ -111,8 +100,8 @@ static void gc_config(void)
git_config_get_int("gc.auto", &gc_auto_threshold);
git_config_get_int("gc.autopacklimit", &gc_auto_pack_limit);
git_config_get_bool("gc.autodetach", &detach_auto);
- git_config_date_string("gc.pruneexpire", &prune_expire);
- git_config_date_string("gc.worktreepruneexpire", &prune_worktrees_expire);
+ git_config_get_expiry("gc.pruneexpire", &prune_expire);
+ git_config_get_expiry("gc.worktreepruneexpire", &prune_worktrees_expire);
git_config(git_default_config, NULL);
}