threads / discuss / 11255

Invalid dates in git log

Subject: Invalid dates in git log

## tl;dr

7 messages between Dec 12, 2007 and Dec 12, 2007.

replies: 6people: 5as markdown or json

Eirik Bjørsnøs· Dec 12, 2007, 09:11 UTC · lore
Hi there,

I'm experiencing a date issue with certain commits in Git in Linus's 2.6 kernel repository.

One commit has a date from 2019, while another commit has a date from
1970. Although Git has been around for a while and seeing a Linux
commit from 2019 would be cool, I think there's something wrong here.
My questions are:
1) Is this a problem in the Git software?
2) Or is it a data corruption issue in the repository?
3) Can it be fixed and should I contact anyone to get it fixed?
I'm doing some log analysis and these two dates mess up my charts.
Steps to reproduce:
$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
$ git  log  a27ac38efd6dc6dccebfc9bcc475ab4aa5fc4a56 -1
commit a27ac38efd6dc6dccebfc9bcc475ab4aa5fc4a56
Author: Len Brown <len.brown@intel.com>
Date:   Fri Apr 5 00:07:45 2019 -0500
    [ACPI] fix merge error that broke CONFIG_ACPI_DEBUG=y build
    Signed-off-by: Len Brown <len.brown@intel.com>
$ git  log  224426f168aa4af3dcb628e6edaa824d32d60e6f  -1
commit 224426f168aa4af3dcb628e6edaa824d32d60e6f
Author: Ursula Braun <braunu@de.ibm.com>
Date:   Thu Jan 1 01:00:01 1970 +0100
    qeth: remove header_ops bug
    Remove qeth bug caused by commit:
    [NET]: Move hardware header operations out of netdevice.
    Signed-off-by: Ursula Braun <braunu@de.ibm.com>
    Signed-off-by: Jeff Garzik <jeff@garzik.org>
Thanks,
Eirik.
Jeff King· Dec 12, 2007, 09:23 UTC · re: Eirik Bjørsnøs · lore

Re: Invalid dates in git log

On Wed, Dec 12, 2007 at 10:11:12AM +0100, Eirik Bjørsnøs wrote:
> My questions are:
> 
> 1) Is this a problem in the Git software?

No. Whoever made the commit probably just didn't have their clock set right. Git doesn't generally care about the timestamp for its operations; it just records it as a historical note.

> 2) Or is it a data corruption issue in the repository?

No. You can check for corruption with git-fsck, but these commits were actually created with bad dates.

> 3) Can it be fixed and should I contact anyone to get it fixed?

Changing the date will change the commit id (since the id is the sha1 of the commit contents). Which would mean rewriting all of the history that follows it. You could do it in your own repository, but then you might have some trouble merging with Linus later on. Linus could do it, but I doubt he will think it is worth the trouble.

> $ git  log  a27ac38efd6dc6dccebfc9bcc475ab4aa5fc4a56 -1
> commit a27ac38efd6dc6dccebfc9bcc475ab4aa5fc4a56
> Author: Len Brown <len.brown@intel.com>
> Date:   Fri Apr 5 00:07:45 2019 -0500
Your best guess is probably the committer information. Try this:
  git log a27ac38 -1 --pretty=format:'Author: %an %ad%nCommitter: %cn %cd'
-Peff
Junio C Hamano· Dec 12, 2007, 09:35 UTC · re: Jeff King · lore

Re: Invalid dates in git log

Jeff King <peff@peff.net> writes:
Show 9 quoted lines
> On Wed, Dec 12, 2007 at 10:11:12AM +0100, Eirik Bjørsnøs wrote:
>
>> My questions are:
>> 
>> 1) Is this a problem in the Git software?
>
> No. Whoever made the commit probably just didn't have their clock set
> right. Git doesn't generally care about the timestamp for its
> operations; it just records it as a historical note.

"git show -s" with --pretty=fuller and --pretty=raw on these two commiits reveal:

    Author:     Ursula Braun <braunu@de.ibm.com>
    AuthorDate: Thu Jan 1 01:00:01 1970 +0100
    Commit:     Jeff Garzik <jeff@garzik.org>
    CommitDate: Fri Oct 19 23:00:02 2007 -0400
    author Ursula Braun <braunu@de.ibm.com> 1 +0100
    committer Jeff Garzik <jeff@garzik.org> 1192849202 -0400
    Author:     Len Brown <len.brown@intel.com>
    AuthorDate: Fri Apr 5 00:07:45 2019 -0500
    Commit:     Len Brown <len.brown@intel.com>
    CommitDate: Tue Jul 12 00:12:09 2005 -0400
    author Len Brown <len.brown@intel.com> 1554440865 -0500
    committer Len Brown <len.brown@intel.com> 1121141529 -0400

So the former commit was made while seting GIT_AUTHOR_DATE explicitly to 1, which is quite likely a bug in some script Jeff used to create this commit about two months ago.

I have no idea about the latter, though. It looks like quite a random timestamp, and committer timestamp look reasonable, relative to the other commits around it.

For a short while, between Nov 11th to Dec 8th this year on 'next' (and between Dec 4th and Dec 8th on 'master'), git-commit-tree accepted an empty GIT_AUTHOR_DATE and recorded a bogus "0" time in the commit by mistake, but such a commit would have shown something like:

    author A U Thor <au.thor@example.com>

without any timestamp, and both commits predate the gotcha, so I do not think they are caused by that recent breakage.

Johannes Schindelin· Dec 12, 2007, 14:59 UTC · re: Junio C Hamano · lore

Re: Invalid dates in git log

Hi,
On Wed, 12 Dec 2007, Junio C Hamano wrote:
Show 10 quoted lines
>     Author:     Len Brown <len.brown@intel.com>
>     AuthorDate: Fri Apr 5 00:07:45 2019 -0500
>     Commit:     Len Brown <len.brown@intel.com>
>     CommitDate: Tue Jul 12 00:12:09 2005 -0400
> 
>     author Len Brown <len.brown@intel.com> 1554440865 -0500
>     committer Len Brown <len.brown@intel.com> 1121141529 -0400
> 
> [...] It looks like quite a random timestamp, and committer timestamp 
> look reasonable, relative to the other commits around it.

It is quite possible that Len Brown had a similar problem to what I experienced yesterday: my clock was set one hour and 22 years into the future, but I have no idea how that happened. My only guess is a half-succeeded ntpdate call, but somehow I doubt that.

Ciao, Dscho

Junio C Hamano· Dec 12, 2007, 18:57 UTC · re: Johannes Schindelin · lore

Re: Invalid dates in git log

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 17 quoted lines
> On Wed, 12 Dec 2007, Junio C Hamano wrote:
>
>>     Author:     Len Brown <len.brown@intel.com>
>>     AuthorDate: Fri Apr 5 00:07:45 2019 -0500
>>     Commit:     Len Brown <len.brown@intel.com>
>>     CommitDate: Tue Jul 12 00:12:09 2005 -0400
>> 
>>     author Len Brown <len.brown@intel.com> 1554440865 -0500
>>     committer Len Brown <len.brown@intel.com> 1121141529 -0400
>> 
>> [...] It looks like quite a random timestamp, and committer timestamp 
>> look reasonable, relative to the other commits around it.
>
> It is quite possible that Len Brown had a similar problem to what I 
> experienced yesterday: my clock was set one hour and 22 years into the 
> future, but I have no idea how that happened.  My only guess is a 
> half-succeeded ntpdate call, but somehow I doubt that.
But how would you explain the more reasonable committer date?

I am guessing that this particular commit was rebased (using rebase, rebase -i, stgit, guilt or something else), and whatever tool that was used had some thinko that broke the author timestamp (and zone).

Nah, exonerate guilt and rebase -i from the list. The commit is from July 2005 which means there wasn't much usable tool for rebasing in the core distribution. Interactive rebase did not exist back then, and rebase was done with "git-commit-script -m", which took an existing commit and used its metainformation when creating a commit. This was almost totally different codepath from what we have now. Not even format-patch nor applymbox existed.

StGIT 0.4 (initial) was Jul 10, 2005, so it is _possible_ (I do not know about plausibility) that it had an early bug that caused this, but if we really want to figure it out we need to ask Len what was used, and I suspect the most likely answer is "are you crazy enough to expect me to remember?".

I am personally more interested in the other one, which was much more recent incident, though.

Eirik Bjørsnøs· Dec 12, 2007, 14:19 UTC · re: Jeff King · lore

Re: Invalid dates in git log

> Your best guess is probably the committer information. Try this:
Thanks Jeff, Junio,
I'll just use the committer date instead.

Being a Git newbie (only started looking at it yesterday) I'm not sure my understanding of "author" and "committer" and how they releate to dates is correct:

* author: Original source of the change. This person may typically
have sent a committer an email with a patch. It's the commiter's
responsibility to supply this information.
* author date: The commiter is free to specify a date for the contribution.
* committer: First committer to actually add this change to a repository
* committer date: Date of the actual commit, added by the git client
during the commit. Typically the system clock at the time of the
commit.
* A transfer of a commit across repositories (pull, push) will not
change the author, commit or date information
If I got some of this wrong, I'd be happy if someone would correct me.
Thanks,
Eirik.
Andreas Ericsson· Dec 12, 2007, 15:51 UTC · re: Eirik Bjørsnøs · lore

Re: Invalid dates in git log

Eirik Bjørsnøs wrote:
Show 10 quoted lines
>> Your best guess is probably the committer information. Try this:
> 
> Thanks Jeff, Junio,
> 
> I'll just use the committer date instead.
> 
> Being a Git newbie (only started looking at it yesterday) I'm not sure
> my understanding of "author" and "committer" and how they releate to
> dates is correct:
> 
They're often the same. They will end up being different if
* you cherry-pick a commit made by someone else.
   ("someone else" is author, you are the committer)
* you rebase a series of commit containing changes from others
   ("others" are the authors, you are the committer)
* you apply a patch using "git am" from someone
   ("someone" is the author, you are the committer)
* you "git commit --amend" a commit from someone else
   ("someone else" is author, you are the committer)

There are probably other cases, but those were the ones I could think of right now.

In short, whenever a commit is modified in some way, it gets a new committer. It might help if you think of author as "contributor" and "committer" as "integrator", where various integrators merge between each other. A merge obviously doesn't fiddle with commits, so once a commit has entered an integrators repository, both author and committer stays intact (that's not strictly true, but for the sake of this argument, which concerns the linux kernel, it will suffice and be mostly correct insofar as I understand the kernel workflow).

> * author: Original source of the change. This person may typically
> have sent a committer an email with a patch. It's the commiter's
> responsibility to supply this information.

No, it's the author's responsibility to supply this information. Author is hardly ever changed.

> * author date: The commiter is free to specify a date for the contribution.
> 
No, the author does that too :)
> * committer: First committer to actually add this change to a repository

No, committer is the person who added the commit to the repository by some other means than merging from another repository.

> * committer date: Date of the actual commit, added by the git client
> during the commit. Typically the system clock at the time of the
> commit.
> 

Sort of, yes, although commits can be created by other means than just running "git commit". The operations listed in bullets at the top of this mail all create new commits, in the sense that they can't have the same SHA1 as their original ones. Hence, committer and commitdate must be updated.

> * A transfer of a commit across repositories (pull, push) will not
> change the author, commit or date information
> 

True. Since neither ancestry nor content is allowed to change, the commit will be exactly the same in the new repository as it was in the old one.

> If I got some of this wrong, I'd be happy if someone would correct me.
> 

I think I just did. Perhaps I missed something, but I'm sure someone will correct me if that's the case.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

← back to recent threads