Signed-off-by: Nguyễn Thái Ngọc Duy <pclo...@gmail.com>
Signed-off-by: Junio C Hamano <gits...@pobox.com>
---
 builtin/gc.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/builtin/gc.c b/builtin/gc.c
index 3bfb990..e38c902 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -55,6 +55,17 @@ static void remove_pidfile_on_signal(int signo)
        raise(signo);
 }
 
+static int git_config_date_string(const char **output,
+                                 const char *var, const char *value)
+{
+       if (value && strcmp(value, "now")) {
+               unsigned long now = approxidate("now");
+               if (approxidate(value) >= now)
+                       return error(_("Invalid %s: '%s'"), var, value);
+       }
+       return git_config_string(output, var, value);
+}
+
 static int gc_config(const char *var, const char *value, void *cb)
 {
        if (!strcmp(var, "gc.packrefs")) {
@@ -84,14 +95,8 @@ static int gc_config(const char *var, const char *value, 
void *cb)
                detach_auto = git_config_bool(var, value);
                return 0;
        }
-       if (!strcmp(var, "gc.pruneexpire")) {
-               if (value && strcmp(value, "now")) {
-                       unsigned long now = approxidate("now");
-                       if (approxidate(value) >= now)
-                               return error(_("Invalid %s: '%s'"), var, value);
-               }
-               return git_config_string(&prune_expire, var, value);
-       }
+       if (!strcmp(var, "gc.pruneexpire"))
+               return git_config_date_string(&prune_expire, var, value);
        return git_default_config(var, value, cb);
 }
 
-- 
2.1.0.rc0.78.gc0d8480

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to