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

Re: approxidate woes

From
Jeff King <peff@peff.net>
Date
Nov 15, 2018, 14:48 UTC
Message-ID
<20181115144854.GB16450@sigill.intra.peff.net>
In-Reply-To
<20181115134528.GA21242@inner.h.apk.li>
On Thu, Nov 15, 2018 at 02:45:28PM +0100, Andreas Krey wrote:
Show 5 quoted lines
> I've now located why our backup repo shrinks every month:
> 
>   git gc --prune=2d
> 
> doesn't do what I expected, and differs a lot from --prune=48h.
Yeah, it understands "2 days", but not "d" as a unit.
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

It might be reasonable to teach approxidate these obvious shorthands (one tricky one is "m"; normally I'd say "minute", but in Git timescales "month" is more likely).

Show 5 quoted lines
> Mildly irritating, and worse, hard to find in the documentation.
> I failed at the latter and fell back to the sources, finding
> './bin-wrappers/test-date approxidate' for trying.
> 
> Where would I look?

I don't think approxidate is really documented at all. It started as Linus's idea of "handle what people would probably say", and the fixes over the years have mostly been "eh, that's crazy, let's do better with this input".

You'd have to reverse engineer it a bit from the source, unfortunately.
-Peff
Previous: Andreas KreyNext: Jeff King
Message 2 of 3 in “approxidate woes”
  1. Andreas KreyNov 15, 2018
  2. Jeff KingNov 15, 2018
  3. Jeff KingNov 15, 2018

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.