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

Re: [BUG] "git commit --date" format parsing

From
Jeff King <peff@peff.net>
Date
May 22, 2015, 22:06 UTC
Message-ID
<20150522220610.GA21848@peff.net>
In-Reply-To
<555F2CBD.8050501@esrevart.net>
On Fri, May 22, 2015 at 03:18:53PM +0200, Bastien Traverse wrote:
Show 22 quoted lines
> $ git --version
> git version 2.4.1
> 
> $ uname -a
> Linux arch-clevo 4.0.4-1-ARCH #1 SMP PREEMPT Mon May 18 06:43:19 CEST
> 2015 x86_64 GNU/Linux
> 
> $ mkdir test && cd test/
> $ git init
> $ touch test
> $ git add test
> 
> 1. ISO 8601 (strict)
> 
> $ git commit --date="2015-05-21T16∶31+02:00" -m "Test commit to check
> date format parsing"
> [master (root commit) fed9ae6] Test commit to check date format parsing
>  Date: Thu May 21 02:00:00 2015 +0200
>  1 file changed, 0 insertions(+), 0 deletions(-)
>  create mode 100644 test
> 
>   --> gets the date right but confuses the timezone for the time

OK, this is weird. When I tried to reproduce, I couldn't. But I had typed in the date string myself while reading your email in another window. And though I was sure that I had typed it correctly, just to be double-plus-sure I copied and pasted your string. And it failed!

The date string in your email looks like this (using cut and paste):
  $ echo 2015-05-21T16∶31+02:00 | xxd
  00000000: 3230 3135 2d30 352d 3231 5431 36e2 88b6  2015-05-21T16...
  00000010: 3331 2b30 323a 3030 0a                   31+02:00.

Your "colon" is actually UTF-8 for code point U+2236 ("RATIO"). So git's date parser does not recognize it, and punts to approxidate(), which does all manner of crazy guessing trying to figure out what you meant.

-Peff
Previous: Bastien TraverseNext: Bastien Traverse
Message 2 of 3 in “[BUG] "git commit --date" format parsing”
  1. Bastien TraverseMay 22, 2015
  2. Jeff KingMay 22, 2015
  3. Bastien TraverseMay 23, 2015

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.