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

Re: Teach "approxidate" about weekday syntax

From
Linus Torvalds <torvalds@osdl.org>
Date
Nov 17, 2005, 23:18 UTC
Message-ID
<Pine.LNX.4.64.0511171505080.13959@g5.osdl.org>
In-Reply-To
<7v1x1eubpr.fsf@assigned-by-dhcp.cox.net>
On Thu, 17 Nov 2005, Junio C Hamano wrote:
Show 7 quoted lines
>
> It is not English but Gittish, which is fine, but it somehow
> reminds me of the funny way users make themselves understood by
> IF parsers ;-).  I am afraid you started small but now are going
> towards the same insanity of gnudate (it has insane yacc grammar
> to grok these things), and I suspect we'd better draw a line
> somewhere.
I think I'm done.

The multi-week "3 sundays ago" part came for free, but the "last sunday" was actually something I liked.

Seriously, I can't imagine what else we'd want. It parses exact dates (thanks to the old date-parsing code), and it now parses all the normal "lazy dates" I can think of.

The fact that you can combine "last saturday" with "three days ago" is really not a feature as much as a result of the algorithm being so simple that it just doesn't care, and the combination just happens to work.

My examples were a bit silly as a result. In real life, you'd probably never use any combinations, but simply use

	"December 5th"
	"last sunday"
	"yesterday"
	"two days ago"
	"12 hours ago"

and the fact that then some (but definitely not all) combinations of the above all work is really just an accident and not something that people should necessarily even depend on.

Show 8 quoted lines
> > Side note 2: if you want to avoid spaces (because of quoting issues), you 
> > can use any non-alphanumberic character instead. So
> >
> > 	git log --since=2.days.ago
> >
> > works without any quotes.
> 
> I think this is a useful change.  Thanks.

That's actually not a new change, the approxidate thing always worked that way, but I thought I'd point it out.

		Linus
Previous: Junio C HamanoNext: Linus Torvalds
Message 5 of 26 in “Teach "approxidate" about weekday syntax”
  1. Linus TorvaldsNov 17, 2005
  2. Nicolas PitreNov 17, 2005
  3. Johannes SchindelinNov 17, 2005
  4. Junio C HamanoNov 17, 2005
  5. Linus TorvaldsNov 17, 2005
  6. Linus TorvaldsNov 17, 2005
  7. David RoundyNov 18, 2005
  8. Johannes SchindelinNov 18, 2005
  9. Randy.DunlapNov 18, 2005
  10. Linus TorvaldsNov 18, 2005
  11. Junio C HamanoNov 19, 2005
  12. Andreas EricssonNov 19, 2005
  13. Randal L. SchwartzNov 19, 2005
  14. Linus TorvaldsNov 19, 2005
  15. Matthias UrlichsNov 18, 2005
  16. Johannes SchindelinNov 20, 2005
  17. H. Peter AnvinNov 18, 2005
  18. Linus TorvaldsNov 18, 2005
  19. Andreas EricssonNov 18, 2005
  20. Linus TorvaldsNov 18, 2005
  21. Johannes SchindelinNov 17, 2005
  22. Martin LanghoffNov 18, 2005
  23. Linus TorvaldsNov 18, 2005
  24. Johannes SchindelinNov 18, 2005
  25. H. Peter AnvinNov 17, 2005
  26. Linus TorvaldsNov 17, 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.