From: Jakub Narebski <jnareb@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "Rhodes, Kate" <masukomi@gmail.com>, git@vger.kernel.org
Subject: Re: ambiguous git-log date and timestamp syntax
Date: Sat, 1 Mar 2008 23:26:04 +0100 [thread overview]
Message-ID: <200803012326.05698.jnareb@gmail.com> (raw)
In-Reply-To: <alpine.LFD.1.00.0803011010480.17889@woody.linux-foundation.org>
On Sat, 1 Mar 2008, Linus Torvalds wrote:
> On Sat, 1 Mar 2008, Jakub Narebski wrote:
> > >
> > > From what I can tell it seems that dates can be specified relatively,
> > > e.g. "2 hours ago", or with any ISO 8601 or RFC 2822 date syntax. Is
> > > this correct, and are there any docs on specifying relative dates?
> >
> > I don't know why git doesn't use getdate_r for this, instead rolling
> > out its own date parsing routines: approxidate*, parse_date. From what
> > I remember it should accept any date "date" (from coreutils) accepts,
> > but it does (from comments) for date to be in "C" locale.
>
> strptime() and getdate() are totally unusable for any real date parsing
> where you don't already know the exact format(s) of the string. And
> neither of them can do any of the useful things that approxidate() does,
> ie handle strings like "two months ago".
>
> So yes, we do our own date parsing, where the "exact" format is the Unix
> epoch timestamp (potentially together with explicit TZ information), but
> we try to parse a wide variety of user-supplied strings that match any of
> the standard formats (and do that loosely, so that when emails etc
> invariably get things wrong and don't actually follow rfc2822 exactly, for
> example, it still tries to make sense of it).
I wonder how it compares with GNU date (from GNU Corutils) inexact date
parsing (and why we couldn't lift the code from GNU date)... I guess that
main goal was to parse correctly "mail" dates, first.
BTW. Git has few other such "reimplementing the wheel" things, like strbuf,
or ALLOC_GROW, or it's own parseopt. I guess main reasons are to avoid
adding yet another dependency, and that existing solutions doesn't fill
all git needs.
--
Jakub Narebski
Poland
next prev parent reply other threads:[~2008-03-01 22:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-01 16:15 ambiguous git-log date and timestamp syntax Rhodes, Kate
2008-03-01 17:10 ` Jakub Narebski
2008-03-01 21:46 ` Linus Torvalds
2008-03-01 22:26 ` Jakub Narebski [this message]
2008-03-02 2:44 ` Johannes Schindelin
2008-03-02 9:40 ` Jakub Narebski
2008-03-02 14:40 ` Johannes Schindelin
2008-03-02 7:09 ` Florian Weimer
2008-03-02 14:11 ` [PATCH] Documentation: Remove --{min,max}-age option from git-log(1) Jakub Narebski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200803012326.05698.jnareb@gmail.com \
--to=jnareb@gmail.com \
--cc=git@vger.kernel.org \
--cc=masukomi@gmail.com \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.