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

Re: [RFC PATCH] approxidate: make "today" wrap to midnight

From
Junio C Hamano <gitster@pobox.com>
Date
May 16, 2026, 00:03 UTC
Message-ID
<87lddkcjau.fsf@gitster.g>
In-Reply-To
<20260515205803.26211-1-taahol@utu.fi>
Tuomas Ahola <taahol@utu.fi> writes:
Show 11 quoted lines
> Although some commands do reject invalid approxidate expressions,
> in other cases those are simply evaluated as the current time.
> Oftentimes that is a perfectly good compromise to handle silly
> requests, but it isn't without rough edges.
>
> Let's consider what "git log --since=today" should yield.
> As it happens that "today" isn't actually a valid approxidate
> format, the command currently tries to list commits with
> *future* timestamps.  Perhaps it would make more sense if
> it returned the commits made since midnight---that is,
> during the current day.
I actually am of two minds about this.  

What should "git log --until=today" do when you run it in the late afternoon? Wouldn't you want to see what you did in the morning and early afternoon?

Because we cannot define "today" as "--since=today means the latest midnight and later, while --until=today means until the end of today [*]" without introducing an extra hint to calls to approxidate() to tell it who is calling for what, it is impossible to give these two sensible behavior at the same time.

    Side note: but because the existing history is all about the past,
    "until the end of today" is by definition a synonym for "up to
    now", so defining "today" the same as "now" would make "until"
    behave just as sensibly as if we define it as "the end of today".

In practice, using "--until" to *not* truncate at all (which is what --until=now or --until=end.of.today would essentially mean) has no practical value, while "--since=beginning.of.today" does have more utility, allowing you to specify "the last 8 hours and 50 minutes" without knowing that it is now at 08:50 in the morning. So I am still in favor of interpreting "today" as "the latest midnight, the beginning of today" because that would give us a more useful behavior than other possible definitions. We may want to strengthen the justification behind the chosen definition of why we chose what we chose over any other time in today with something like what I said above, mentioning "--until".

Thanks.
Previous: Tuomas AholaNext: Tuomas Ahola
Message 2 of 5 in “approxidate: make "today" wrap to midnight”
  1. approxidate: make "today" wrap to midnightTuomas Ahola, May 15, 2026
  2. Junio C HamanoMay 16, 2026
  3. approxidate: make "today" wrap to midnightTuomas Ahola, May 16, 2026
  4. Junio C HamanoMay 16, 2026
  5. Tuomas AholaMay 16, 2026

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.