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

Timestamp of zero in reflog considered invalid

From
EBErik Bray <erik.m.bray@gmail.com>
Date
Apr 5, 2016, 11:28 UTC
Message-ID
<CAOTD34YpTXperaC0=Sy=21Q9_+0eGO1y-bP-WzrkxFvrDykRXg@mail.gmail.com>
Hi all,

I found this issue through a test suite for a Python git interface, which during the tests at some point sets

GIT_COMMITTER_DATE=1970-01-01T00:00:00
To reproduce the issue:

$ git init $ echo foo > testfile $ git add testfile $ git commit -m "test" $ echo bar >> testfile $ export GIT_COMMITTER_DATE=1970-01-01T00:00:00 $ git stash save $ git stash apply refs/stash@{0} is not a valid reference

At this point one can see:

$ git rev-parse --symbolic --verify 'refs/stash@{0}' fatal: Log for refs/stash is empty.

Expected:

$ git rev-parse --symbolic --verify 'refs/stash@{0}' refs/stash@{0}

I tracked the issue to refs/files-backend.c in show_one_reflog_ent :
https://github.com/git/git/blob/11529ecec914d2f0d7575e6d443c2d5a6ff75424/refs/files-backend.c#L2923
in which
!(timestamp = strtoul(email_end + 2, &message, 10)) ||

implies an invalid reflog entry. Why should 0 be treated as an invalid timestamp (even if it's unlikely outside of corner cases)?

Thanks, Erik

Next: Junio C Hamano
Message 1 of 5 in “Timestamp of zero in reflog considered invalid”
  1. Erik BrayApr 5, 2016
  2. Junio C HamanoApr 5, 2016
  3. Andreas SchwabApr 5, 2016
  4. Johannes SchindelinApr 6, 2016
  5. Erik BrayApr 6, 2016

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.