Merge branch 'jc/maint-reflog-bad-timestamp'
[git.git] / sha1_name.c
index 9215ad1d050c427b67124f4c5ca76e60e8e022f0..c7f1510ef102512f1270a064fbb7a842b1d9aed9 100644 (file)
@@ -413,9 +413,12 @@ 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);
                        free(tmp);
+                       if (errors)
+                               return -1;
                }
                if (read_ref_at(real_ref, at_time, nth, sha1, NULL,
                                &co_time, &co_tz, &co_cnt)) {