Skip to content

Commit

Permalink
Accept dates before 2000/01/01 when specified as seconds since the epoch
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Johannes Sixt authored and gitster committed Jun 6, 2007
1 parent 41cf68a commit a1a5a63
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions date.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a1a5a63

Please sign in to comment.