summaryrefslogtreecommitdiff
path: root/date.c
diff options
context:
space:
mode:
authorJohannes Sixt <johannes.sixt@telecom.at>2007-06-06 10:11:55 +0200
committerJunio C Hamano <gitster@pobox.com>2007-06-06 15:20:12 -0700
commita1a5a6347b4ac1005c5d9c2b636e906bf6c8ec12 (patch)
treef781505463b4fe5dcccbb756668ce325ddeee648 /date.c
parent41cf68a85ca2a9199b32eb3932582b234fa474b4 (diff)
downloadgit-a1a5a6347b4ac1005c5d9c2b636e906bf6c8ec12.tar.gz
Accept dates before 2000/01/01 when specified as seconds since the epoch
Tests with git-filter-branch on a repository that was converted from CVS and that has commits reaching back to 1999 revealed that it is necessary to parse dates before 2000/01/01 when they are specified as seconds since 1970/01/01. There is now still a limit, 100000000, which is 1973/03/03 09:46:40 UTC, in order to allow that dates are represented as 8 digits. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'date.c')
-rw-r--r--date.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/date.c b/date.c
index a9b59a289e..4690371e55 100644
--- a/date.c
+++ b/date.c
@@ -414,9 +414,11 @@ static int match_digit(const char *date, struct tm *tm, int *offset, int *tm_gmt
num = strtoul(date, &end, 10);
/*
- * Seconds since 1970? We trigger on that for anything after Jan 1, 2000
+ * Seconds since 1970? We trigger on that for any numbers with
+ * more than 8 digits. This is because we don't want to rule out
+ * numbers like 20070606 as a YYYYMMDD date.
*/
- if (num > 946684800) {
+ if (num >= 100000000) {
time_t time = num;
if (gmtime_r(&time, tm)) {
*tm_gmt = 1;