Re: git's rev-parse.c function show_datestring presumes gnu date
- From
Linus Torvalds <torvalds@osdl.org>
- Date
- Nov 14, 2005, 23:08 UTC
- Message-ID
- <Pine.LNX.4.64.0511141504530.3263@g5.osdl.org>
- In-Reply-To
- <86zmo6vnnj.fsf@blue.stonehenge.com>
On Mon, 14 Nov 2005, Randal L. Schwartz wrote:
Show 6 quoted lines
> > git-rev-parse calls GNU date externally for --since, --after, --before, > and --until, which will fail on at least OpenBSD and Mac OSX (Darwin). > > At a minimum, this code can be commented out on such platforms. Better > would be to have some sort of suitable replacement.
I really wanted to do the date parsing myself, rather than call out to date, but I got lazy.
It shouldn't be all that difficult to do some trivial cases (gnu date handles totally insane things, we could easily do with just a simpler thing).
Anybody want to handle
- partial real dates ("August 5th" - figure out the year automatically,
and notice that it might be _last_ year since the date only makes
sense if it's in the past)
- relative dates ("5 days ago", "yesterday", "one week ago")It shouldn't be that hard, and if you do _not_ touch the date.c functions (which have to be totally dependable) you can be pretty damn lazy and lax and just guess a lot.
Linus