Re: [RFC] git gc "--prune=now" semantics considered harmful
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- Jun 1, 2018, 11:07 UTC
- Message-ID
- <CA+55aFz5cwZa_PWMV2aGv0TGBpBz8OUB-dPvdwv4ouQs1t1mzA@mail.gmail.com>
- In-Reply-To
- <20180601070456.GB15578@sigill.intra.peff.net>
On Fri, Jun 1, 2018 at 2:04 AM Jeff King <peff@peff.net> wrote:
Show 7 quoted lines
> > We'd also accept relative times like "5.minutes.ago" (in fact, the > default is a relative 2.weeks.ago, though it's long enough that the > difference between "2 weeks" and "2 weeks plus 5 minutes" may not matter > much). So we probably ought to just normalize _everything_ without even > bothering to match "now". It's a noop for non-relative times, but that's > OK.
Heh. That's what I tried to do at first.
It's surprisingly hard.
You can't normalize it as a date, because we have a few times that aren't expressible as dates because they are just the maximum value (ie "all").
And then I tried to just express it just as a standard numerical value, which we accept on input. But we *only* accept that if it's more than eight digits.
And regardless, you need to special-case "now", since parse_expiry_date() special cases it.
Or you'd need to just make another version of parse_expiry_date() entirely.
End result: I only special-cased "now".
> There are still possibilities for a race, even with the grace period.
Agreed. But you *really* have to work at it.
Linus