]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/gc.c
parseopt: handle malformed --expire arguments more nicely
[thirdparty/git.git] / builtin / gc.c
index 841782c8593186a538750453806d23e7f76a8ff8..90a10679714d000c0a4b386963def520d3f5d61c 100644 (file)
@@ -353,6 +353,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
        const char *name;
        pid_t pid;
        int daemonized = 0;
+       timestamp_t dummy;
 
        struct option builtin_gc_options[] = {
                OPT__QUIET(&quiet, N_("suppress progress reporting")),
@@ -388,6 +389,9 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
        if (argc > 0)
                usage_with_options(builtin_gc_usage, builtin_gc_options);
 
+       if (prune_expire && parse_expiry_date(prune_expire, &dummy))
+               die(_("failed to parse prune expiry value %s"), prune_expire);
+
        if (aggressive) {
                argv_array_push(&repack, "-f");
                if (aggressive_depth > 0)