Re: approxidate woes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux