From: Diomidis Spinellis Date: Tue, 10 Sep 2019 17:19:49 GMT Subject: Re: Patching Git to handle dates before the Unix epoch 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: > 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. [...] >> - 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