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

Well-past commit dates unsupported

From
JLJean LAULIAC <jean@lauliac.com>
Date
Oct 28, 2013, 10:04 UTC
Message-ID
<CALM1TLiVTq6kPB7Ke_VDEc+Fs8u5NknCOHH_CuOzphQY3b_HeA@mail.gmail.com>
Hi there,

I'm trying to use a well-past date for a git commit, before the UNIX Epoch, but this does not work for the reasons below. I'm on Mac OS X 10.8, git version 1.8.3.4, and `sizeof(time_t) == 8`. The date I'm trying to set is October 4, 1958, that is around timestamp -354808800.

First technique, using the commit `--date` flags with ISO 8601: it says "invalid date".

Second technique, described in the git ml archive, not using the porcelain: http://article.gmane.org/gmane.comp.version-control.git/152497/

    git commit
    git cat-file -p HEAD > tmp.txt
    # at this point, edit the file to replace the timestamp
    git hash-object -t commit -w tmp.txt
    #=> 2ee8fcc02658e23219143f5bcfe6f9a4615745f9
    git update-ref -m 'commit: foo' refs/heads/master \
        2ee8fcc02658e23219143f5bcfe6f9a4615745f9

Commit date is effectively updated, but `git show` clamps the date to zero (`Jan 1 1970`). `tig(1)` displays `55 years ago` so the actual commit date is properly stored.

Last issue: when trying to push this commit to a remote repository:
    #=> remote: error: object 2ee8fcc02658e23219143f5bcfe6f9a4615745f9:invalid
    #       author/committer line - bad date
    #=> remote: fatal: Error in object
    #=> error: unpack failed: index-pack abnormal exit
Finally, when running `test-date` from git sources:
    ./test-date show -354808800
    #=> -354808800 -> in the future

Is it a deliberate git behavior? Is fully supporting past or far future dates in the roadmap, since the referenced message above from 2010? Should I try to make a patch?

Thanks!
PS: use case for past dates is to match the historical law changes. As others
did before, I'm trying to map the history of France Constitution to git.
-- 
Jean Lauliac <jean@lauliac.com>
Message 1 of 1 in “Well-past commit dates unsupported”
  1. Jean LAULIACOct 28, 2013

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.