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

Inconsistency between git-log documentation and behavior regarding default date format.

From
RDRafael Dulfer <rafael@dulfer.be>
Date
Jan 24, 2023, 15:09 UTC
Message-ID
<9c3428f6-a254-13b4-046d-6e20ef602aef@dulfer.be>
In-Reply-To
<793c8116-f7ea-eef2-6979-231c3e94639a@dulfer.be>

The Git documentation <https://www.git-scm.com/docs/git-log#Documentation/git-log.txt---dateltformatgt> states that if no date format is given (or --date=default is given), the date format is similar to rfc2822 except of a few exceptions, of which those listed are:

   * There is no comma after the day-of-week
   * The time zone is omitted when the local time zone is used

However, if we were to compare the two date formats, you can see another difference:

git log --default  ->  Tue Jan 24 11:03:47 2023 +0100 git log --rfc          ->  Tue, 24 Jan 2023 11:03:47 +0100

With the default, the month and day-of-month are switched around. From my own quick investigation, this behavior occurs because of the statement found at date.c#L266 <https://github.com/git/git/blob/56c8fb1e95377900ec9d53c07886022af0a5d3c2/date.c#L266> wherein the month is inserted before the day-of-month. I am unsure which behavior is exactly intended and whether this discrepancy was known, but it would probably be a good idea to have a note of it in the documentation.

Next: Andrei Rybak
Message 1 of 3 in “Inconsistency between git-log documentation and behavior regarding default date format.”
  1. Rafael DulferJan 24, 2023
  2. Andrei RybakFeb 1, 2023
  3. Jeff KingFeb 1, 2023

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.