From: Jeff King <peff@peff.net>
To: Andreas Krey <a.krey@gmx.de>
Cc: git@vger.kernel.org
Subject: Re: approxidate woes
Date: Thu, 15 Nov 2018 09:54:07 -0500 [thread overview]
Message-ID: <20181115145407.GC16450@sigill.intra.peff.net> (raw)
In-Reply-To: <20181115144854.GB16450@sigill.intra.peff.net>
On Thu, Nov 15, 2018 at 09:48:54AM -0500, Jeff King wrote:
> I don't think "48h" does what you expect either:
>
> $ t/helper/test-date approxidate now
> now -> 2018-11-15 14:43:32 +0000
>
> $ t/helper/test-date approxidate 48h
> 48h -> 2018-11-15 14:43:34 +0000
>
> $ t/helper/test-date approxidate 48.hours
> 48.hours -> 2018-11-13 14:43:38 +0000
Whoops, those should all be:
t/helper/test-tool date approxidate ...
in recent versions of Git (I was bisecting something earlier, and has a
crufty test-date left over from an old version!).
Adding new unit aliases would be something like:
diff --git a/date.c b/date.c
index 9bc15df6f9..eb477d1601 100644
--- a/date.c
+++ b/date.c
@@ -1016,6 +1016,7 @@ static const struct typelen {
{ "minutes", 60 },
{ "hours", 60*60 },
{ "days", 24*60*60 },
+ { "d", 24*60*60 },
{ "weeks", 7*24*60*60 },
{ NULL }
};
but I suspect we need to tighten up the string matching a bit. I think
that would allow "2 dogs" to be parsed as "days".
-Peff
prev parent reply other threads:[~2018-11-15 14:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-15 13:45 approxidate woes Andreas Krey
2018-11-15 14:48 ` Jeff King
2018-11-15 14:54 ` Jeff King [this message]
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=20181115145407.GC16450@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=a.krey@gmx.de \
--cc=git@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).