git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Randal L. SchwartzNext: Linus Torvalds
Message 2 of 3 in “git's rev-parse.c function show_datestring presumes gnu date”
  1. Randal L. SchwartzNov 14, 2005
  2. Linus TorvaldsNov 14, 2005
  3. Linus TorvaldsNov 15, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.