{"thread":{"id":"59146","subject":"Inconsistency between git-log documentation and behavior regarding default date format.","startedAt":"2023-01-24T15:09:06Z","lastAt":"2023-02-01T11:51:56Z","messageCount":3,"participants":["Rafael Dulfer","Andrei Rybak","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"470979","messageId":"9c3428f6-a254-13b4-046d-6e20ef602aef@dulfer.be","threadId":"59146","inReplyTo":"793c8116-f7ea-eef2-6979-231c3e94639a@dulfer.be","subject":"Inconsistency between git-log documentation and behavior regarding default date format.","fromName":"Rafael Dulfer","fromEmail":"rafael@dulfer.be","sentAt":"2023-01-24T15:09:00Z","receivedAt":"2023-01-24T15:09:06Z","isPatch":false,"sender":{"key":"rafael@dulfer.be","avatar":null},"body":"The Git documentation \n<https://www.git-scm.com/docs/git-log#Documentation/git-log.txt---dateltformatgt> states \nthat if no date format is given (or --date=default is given), the date \nformat is similar to rfc2822 except of a few exceptions, of which those \nlisted are:\n\n   * There is no comma after the day-of-week\n   * The time zone is omitted when the local time zone is used\n\nHowever, if we were to compare the two date formats, you can see another \ndifference:\n\ngit log --default  ->  Tue Jan 24 11:03:47 2023 +0100\ngit log --rfc          ->  Tue, 24 Jan 2023 11:03:47 +0100\n\nWith the default, the month and day-of-month are switched around. From \nmy own quick investigation, this behavior occurs because of the \nstatement found at date.c#L266 \n<https://github.com/git/git/blob/56c8fb1e95377900ec9d53c07886022af0a5d3c2/date.c#L266> \nwherein the month is inserted before the day-of-month. I am unsure which \nbehavior is exactly intended and whether this discrepancy was known, but \nit would probably be a good idea to have a note of it in the documentation.\n"},{"id":"471212","messageId":"8d72f484-6a72-87f9-44f1-3a38471201db@gmail.com","threadId":"59146","inReplyTo":"9c3428f6-a254-13b4-046d-6e20ef602aef@dulfer.be","subject":"Re: Inconsistency between git-log documentation and behavior regarding default date format.","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-02-01T01:33:49Z","receivedAt":"2023-02-01T01:34:01Z","isPatch":false,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"On 24/01/2023 16:09, Rafael Dulfer wrote:\n> The Git documentation \n> <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:\n> \n>    * There is no comma after the day-of-week\n>    * The time zone is omitted when the local time zone is used\n> \n> However, if we were to compare the two date formats, you can see another \n> difference:\n> \n> git log --default  ->  Tue Jan 24 11:03:47 2023 +0100\n> git log --rfc          ->  Tue, 24 Jan 2023 11:03:47 +0100\n\nIt seems that options in these samples were mistyped. They are missing \nthe \"--date=\" part:\n\n\n     $ git log -1 --date=default  master | grep 'Date:'\n     Date:   Sat Jan 21 16:35:14 2023 -0800\n\n     $ git log -1 --date=rfc2822   master | grep 'Date:'\n     Date:   Sat, 21 Jan 2023 16:35:14 -0800\n\n> \n> With the default, the month and day-of-month are switched around. From \n> my own quick investigation, this behavior occurs because of the \n> statement found at date.c#L266 \n> <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.\n\nIndeed, the description of the option (which comes from \nDocumentation/rev-list-options.txt) doesn't describe all differences\nbetween --date=default and --date=rfc2822.\n\nA fuller list could be:\n\n     * There is no comma after the day-of-week\n     * The time zone is omitted when the local time zone is used\n     * Day-of-month and month are switched around\n     * Time-of-day and the year are switched around\n\nCC'ing Peff, who wrote the list of exceptions in add00ba2de (date: make \n\"local\" orthogonal to date format, 2015-09-03).\n"},{"id":"471232","messageId":"Y9pSWCS1BNkHt+Mw@coredump.intra.peff.net","threadId":"59146","inReplyTo":"8d72f484-6a72-87f9-44f1-3a38471201db@gmail.com","subject":"Re: Inconsistency between git-log documentation and behavior regarding default date format.","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-02-01T11:51:52Z","receivedAt":"2023-02-01T11:51:56Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Feb 01, 2023 at 02:33:49AM +0100, Andrei Rybak wrote:\n\n> Indeed, the description of the option (which comes from\n> Documentation/rev-list-options.txt) doesn't describe all differences\n> between --date=default and --date=rfc2822.\n> \n> A fuller list could be:\n> \n>     * There is no comma after the day-of-week\n>     * The time zone is omitted when the local time zone is used\n>     * Day-of-month and month are switched around\n>     * Time-of-day and the year are switched around\n> \n> CC'ing Peff, who wrote the list of exceptions in add00ba2de (date: make\n> \"local\" orthogonal to date format, 2015-09-03).\n\nI don't think I had any particular reason to omit those other\ndifferences. I probably just didn't notice them. Patches welcome.\n\n-Peff\n"}]}