Skip to content

Commit a1a5a63

Browse files
Johannes Sixtgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 41cf68a commit a1a5a63

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

date.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,11 @@ static int match_digit(const char *date, struct tm *tm, int *offset, int *tm_gmt
414414
num = strtoul(date, &end, 10);
415415

416416
/*
417-
* Seconds since 1970? We trigger on that for anything after Jan 1, 2000
417+
* Seconds since 1970? We trigger on that for any numbers with
418+
* more than 8 digits. This is because we don't want to rule out
419+
* numbers like 20070606 as a YYYYMMDD date.
418420
*/
419-
if (num > 946684800) {
421+
if (num >= 100000000) {
420422
time_t time = num;
421423
if (gmtime_r(&time, tm)) {
422424
*tm_gmt = 1;

0 commit comments

Comments
 (0)