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

Re: [Bug] worktree prune --expires

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 30, 2021, 21:10 UTC
Message-ID
<xmqqim58cpqa.fsf@gitster.g>
In-Reply-To
<011901d72596$e5ed8670$b1c89350$@nexbridge.com>
"Randall S. Becker" <rsbecker@nexbridge.com> writes:
Show 5 quoted lines
> This is pretty much just a quibble, but the command parser for worktree
> prune --expires should really report when a timestamp is invalid. For
> example:
>
> worktree prune --expires A:30 actually

Assuming that you had "git" in front, and spelled "--expire" without the extra 's':

$ git worktree prune --expire no.such.date fatal: malformed expiration date 'no.such.date'

So apparently, "A:30" is taken as a expiration date that is not malformed.

$ git rev-parse --since=A:30 --until=now --max-age=1617138312 --min-age=1617138312

Appears to show that A:30 is interpreted as the same as 'now', but thta is an unlucky coincidence of the day.

What happens in this case is that "A:" is discarded as cruft (just like dots are discarded in "git log --since=8.days.ago"), and only the "30" takes effect of filling an unspecified "date of the month" [*1*]. And then the remainder is taken from the wallclock time, and that is how the above "rev-parse" shows the same for A:30 and now, as it is the 30th of the month for me right now.

$ git rev-parse --since=A:31 --until=now --max-age=1617224881 --min-age=1617138481

gives me the same time tomorrow (for the same reason that today's 30th for me).

[Footnote]

*1* In A:30, there is no "date of month", "month", "year", etc. specified, so we start from all unspecified, take the first number that is discovered (i.e. 30) and fill "date of the month" with it.

Previous: Randall S. BeckerNext: Randall S. Becker
Message 2 of 3 in “[Bug] worktree prune --expires”
  1. Randall S. BeckerMar 30, 2021
  2. Junio C HamanoMar 30, 2021
  3. Randall S. BeckerMar 30, 2021

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.