Thread (12 messages) flat view 12 messages, 5 authors, 2025-09-24

Re: 0-Based indexes for git log

From: Emily Shaffer <hidden>
Date: 2025-09-24 17:22:30

On Wed, Sep 24, 2025 at 10:15 AM 𝕍𝕖𝕝𝕠𝕔𝕚𝕗𝕪𝕖𝕣
[off-list ref] wrote:
quoted
In git log it uses a 1-based index for the date instead of a 0 based
index. So it says "Fri Sep 19 14:23:24 2025 -0400" when it should say
"Fri Sep 18 14:23:24 2025 -0400" (or "Friday 2025-8-18 14:23:24
(-4:00.00)"  to get a better format)
I suggest git adds a config option for 0-based date and automaticly uses
0-based date if there is a file at $HOME/use-0-based-index-for-date or
$USE-0-BASED-INDEX-FOR-DATE == true
Git uses strftime from libc for date formatting. strftime[1] doesn't
offer a way to format the date as you prefer - what you're asking for
appears to be a personal preference, not a standard in any community
of the world. I think that your best bet would be to attempt to
contribute an option to strftime to render the day of the month from
0-30, but I would be surprised if such a contribution were to be
welcomed - as, again, this looks like a preference held by very few.
Based on my quick refresher through date.[ch] in the Git codebase, it
would be infeasible to add such a flag and custom formatting.

However, Git is open source software, and you're fully welcome to
patch your copy of Git to accept such a config (or this ~/some-file,
which is not a way Git typically sets configuration) and build it
yourself locally.

1: https://www.man7.org/linux/man-pages/man3/strftime.3.html
--
George truly, 𝕍𝕖𝕝𝕠𝕔𝕚𝕗𝕪𝕖𝕣
This email does not constitute a legally binding contract
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help