git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Accept dates before 2000/01/01 when specified as seconds since the epoch
@ 2007-06-06  8:11 Johannes Sixt
  2007-06-06  8:29 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Sixt @ 2007-06-06  8:11 UTC (permalink / raw)
  To: git, junkio; +Cc: Johannes Sixt

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>
---
 date.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/date.c b/date.c
index a9b59a2..4690371 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;
-- 
1.5.2.1.120.gd732

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-06-07  5:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-06  8:11 [PATCH] Accept dates before 2000/01/01 when specified as seconds since the epoch Johannes Sixt
2007-06-06  8:29 ` Junio C Hamano
2007-06-06 10:42   ` Johannes Sixt
2007-06-07  5:09   ` Sam Vilain
2007-06-07  5:29     ` Junio C Hamano
2007-06-07  5:30     ` Johannes Schindelin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).