]> git.ipfire.org Git - thirdparty/git.git/commit - date.c
Improve on 'approxidate'
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 22 Aug 2009 22:10:07 +0000 (15:10 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 23 Aug 2009 01:51:05 +0000 (18:51 -0700)
commit9029055207443c28ca65a705d1a1b96cce3995fd
treea26a799c35679786ae8241ab3c50d5a6416c24c1
parent32f4cc49ae742e496355bea93c7b9481336f12cd
Improve on 'approxidate'

This is not a new failure mode - approxidate has always been kind of
random in the input it accepts, but some of the randomness is more
irritating than others.

For example:

Jun 6, 5AM -> Mon Jun 22 05:00:00 2009
5AM Jun 6 -> Sat Jun  6 05:00:00 2009

Whaa? The reason for the above is that approxidate squirrells away the '6'
from "Jun 6" to see if it's going to be a relative number, and then
forgets about it when it sees a new number (the '5' in '5AM'). So the odd
"June 22" date is because today is July 22nd, and if it doesn't have
another day of the month, it will just pick todays mday - having ignored
the '6' entirely due to getting all excited about seeing a new number (5).

There are other oddnesses. This does not fix them all, but I think it
makes for fewer _really_ perplexing cases. At least now we have

Jun 6, 5AM -> Sat Jun  6 05:00:00 2009
5AM, Jun 6 -> Sat Jun  6 05:00:00 2009

which makes me happier. I can still point to cases that don't work as
well, but those are separate issues.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
date.c