peel_object(): give more specific information in return value
[gitweb.git] / builtin / reflog.c
index 062d7dad1b5af720e70adcaa05b60bf68977b05c..44700f92432adf9545d160e698fd57aa3cc07d29 100644 (file)
@@ -330,8 +330,10 @@ static int expire_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
                printf("keep %s", message);
        return 0;
  prune:
-       if (!cb->newlog || cb->cmd->verbose)
-               printf("%sprune %s", cb->newlog ? "" : "would ", message);
+       if (!cb->newlog)
+               printf("would prune %s", message);
+       else if (cb->cmd->verbose)
+               printf("prune %s", message);
        return 0;
 }
 
@@ -494,11 +496,9 @@ static int parse_expire_cfg_value(const char *var, const char *value, unsigned l
 {
        if (!value)
                return config_error_nonbool(var);
-       if (!strcmp(value, "never") || !strcmp(value, "false")) {
-               *expire = 0;
-               return 0;
-       }
-       *expire = approxidate(value);
+       if (parse_expiry_date(value, expire))
+               return error(_("%s' for '%s' is not a valid timestamp"),
+                            value, var);
        return 0;
 }
 
@@ -611,11 +611,13 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
                if (!strcmp(arg, "--dry-run") || !strcmp(arg, "-n"))
                        cb.dry_run = 1;
                else if (!prefixcmp(arg, "--expire=")) {
-                       cb.expire_total = approxidate(arg + 9);
+                       if (parse_expiry_date(arg + 9, &cb.expire_total))
+                               die(_("'%s' is not a valid timestamp"), arg);
                        explicit_expiry |= EXPIRE_TOTAL;
                }
                else if (!prefixcmp(arg, "--expire-unreachable=")) {
-                       cb.expire_unreachable = approxidate(arg + 21);
+                       if (parse_expiry_date(arg + 21, &cb.expire_unreachable))
+                               die(_("'%s' is not a valid timestamp"), arg);
                        explicit_expiry |= EXPIRE_UNREACH;
                }
                else if (!strcmp(arg, "--stale-fix"))