From: Junio C Hamano <gitster@pobox.com>
To: Tuomas Ahola <taahol@utu.fi>
Cc: <git@vger.kernel.org>, Jeff King <peff@peff.net>
Subject: Re: [RFC PATCH] approxidate: make "today" wrap to midnight
Date: Sat, 16 May 2026 09:03:21 +0900 [thread overview]
Message-ID: <87lddkcjau.fsf@gitster.g> (raw)
In-Reply-To: <20260515205803.26211-1-taahol@utu.fi> (Tuomas Ahola's message of "Fri, 15 May 2026 23:58:03 +0300")
Tuomas Ahola <taahol@utu.fi> writes:
> 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.
prev parent reply other threads:[~2026-05-16 0:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-15 20:58 [RFC PATCH] approxidate: make "today" wrap to midnight Tuomas Ahola
2026-05-16 0:03 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lddkcjau.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=taahol@utu.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox