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

Re: Patching Git to handle dates before the Unix epoch

From
Diomidis Spinellis <dds@aueb.gr>
Date
Sep 10, 2019, 17:19 UTC
Message-ID
<7a9fdb7d-265f-a877-1a5d-619890910340@aueb.gr>
In-Reply-To
<20190910162629.GA12758@sigill.intra.peff.net>
On 10-Sep-19 19:26, Jeff King wrote:
Show 7 quoted lines
> On Tue, Sep 10, 2019 at 05:14:53PM +0300, Diomidis Spinellis wrote:
>> As people use Git to create synthetic commits of code written in the past
>> [1,2] it becomes important to handle dates before the Unix epoch (1/1/1970).
>> I see that modern C libraries, Unix kernels, and tools can handle such
>> dates.  However Git seems to mishandle such dates in several places, such as
>> in date.c [3,4].  I'm planning to work on a fix, but before I embark on this
>> I have a few questions.
[...]
Show 5 quoted lines
>> - Can you think of any non-obvious issues (e.g. backward compatibility,
>> switch to the Gregorian calendar) I should be aware of?
> 
> The big question is: what will existing implementations do with a commit
> object that contains a negative timestamp?

Negative timestamps can already be created, because some Git libraries can create such objects, and one can also create them by hand; see http://git.661346.n2.nabble.com/Back-dating-commits-way-back-for-constitution-git-tp5365303p5367657.html

Consequently, I don't think that worrying about how existing clients will handle such timestamps should be a big issue, as long as we don't break the handling of modern dates.

 > Coincidentally I was looking into this yesterday. See below.
[...]
> Here's how far I got working on this yesterday. It's quite messy, but
> seems to work at least for basic tests like:

Amazing! Given that you have made significant progress, I think it's best to leave it to you to complete it, right?

Diomidis
Previous: Jeff KingNext: Jeff King
Message 5 of 6 in “Patching Git to handle dates before the Unix epoch”
  1. Diomidis SpinellisSep 10, 2019
  2. Randall S. BeckerSep 10, 2019
  3. Jeff KingSep 10, 2019
  4. Jeff KingSep 10, 2019
  5. Diomidis SpinellisSep 10, 2019
  6. Jeff KingSep 13, 2019

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.