git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Timestamp of zero in reflog considered invalid
@ 2016-04-05 11:28 Erik Bray
  2016-04-05 15:52 ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Erik Bray @ 2016-04-05 11:28 UTC (permalink / raw)
  To: git

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-04-06 13:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-05 11:28 Timestamp of zero in reflog considered invalid Erik Bray
2016-04-05 15:52 ` Junio C Hamano
2016-04-05 17:41   ` Andreas Schwab
2016-04-06 12:18   ` Johannes Schindelin
2016-04-06 13:20   ` Erik Bray

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).