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

[PATCH] rev-list: clarify git-log default date format

From
RDRafael Dulfer <rafael@dulfer.be>
Date
Feb 1, 2023, 15:57 UTC
Message-ID
<20230201155712.86577-1-rafael@dulfer.be>
From: Rafael Dulfer <rafael.dulfer@gmail.com>
Currently, the documentation is slightly incomplete, not explaining all the differences the default format has with rfc2822. Leading to confusion for people trying to parse the date format outputted by git log
This patch adds 2 more exceptions when compared to rfc2822. Also adds an example of what the format looks like (I originally wanted to specify this in strftime notation, but because of the way day-of-month is formatted this is impossible)
Signed-off-by: Rafael Dulfer <rafael.dulfer@gmail.com>
---
 Documentation/rev-list-options.txt | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
index ff68e48406..8bc8475f3e 100644
--- a/Documentation/rev-list-options.txt
+++ b/Documentation/rev-list-options.txt
@@ -1103,9 +1103,15 @@ format placeholders. When using `-local`, the correct syntax is
 `--date=default` is the default format, and is similar to
 `--date=rfc2822`, with a few exceptions:
 --
-	- there is no comma after the day-of-week
+	- There is no comma after the day-of-week
 
-	- the time zone is omitted when the local time zone is used
+	- The time zone is omitted when the local time zone is used
+
+	- Day-of-month and month are switched around
+
+	- Time-of-day and the year are switched around
+
+As a result, the format looks as follows: `Thu Jan 1 00:00:00 1970 +0000` with `+0000` being omitted when the local time zone is used.
 
 ifdef::git-rev-list[]
 --header::
-- 
2.39.1
Next: Junio C Hamano
Message 1 of 13 in “rev-list: clarify git-log default date format”
  1. rev-list: clarify git-log default date formatRafael Dulfer, Feb 1, 2023
  2. Junio C HamanoFeb 1, 2023
  3. Jeff KingFeb 1, 2023
  4. Ævar Arnfjörð BjarmasonFeb 1, 2023
  5. Junio C HamanoFeb 1, 2023
  6. Rafael DulferFeb 2, 2023
  7. Junio C HamanoFeb 2, 2023
  8. Junio C HamanoFeb 2, 2023
  9. rev-list: clarify git-log default date formatJunio C Hamano, Feb 16, 2023
  10. Jeff KingFeb 16, 2023
  11. Junio C HamanoFeb 16, 2023
  12. rev-list: clarify git-log default date formatJunio C Hamano, Feb 16, 2023
  13. Jeff KingFeb 16, 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.