approxidate_careful() reports errorneous date string
[git/git.git] / sha1_name.c
index 44bb62d..f4a74fe 100644 (file)
@@ -395,8 +395,11 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
                } else if (0 <= nth)
                        at_time = 0;
                else {
+                       int errors = 0;
                        char *tmp = xstrndup(str + at + 2, reflog_len);
-                       at_time = approxidate(tmp);
+                       at_time = approxidate_careful(tmp, &errors);
+                       if (errors)
+                               die("Bogus timestamp '%s'", tmp);
                        free(tmp);
                }
                if (read_ref_at(real_ref, at_time, nth, sha1, NULL,