2

I track all my projects in git. Unfortunately, in my main repository the author date seems to be stuck. It reports as July 15, 12:25:08 -0500 for almost every commit since then. The commit date seems to be working correctly. There is evidence this might be happening in another repository, but it doesn't change enough for me to know for sure.

I've checked the .git/config file, as well as my global .gitconfig file. I can't think of anything special that happened on that day.

I'd like to figure out what's causing this so I can fix it. For bonus points, I'd like to fix all the bad author dates. Since I'm the sole developer (at this point in time) I think it's pretty safe to update all the clones (local repo, local server, GitHub).

Edit: So far, it looks like magit in Emacs might be doing it. However, I still don't know how or why.

Michael Johnson
  • 2,287
  • 16
  • 21
  • What's an author date? Are you sure you don't just have your name set as something that looks like a date? – Jonathan Wren Sep 11 '13 at 21:53
  • 2
    @Duotrigesimal: each commit has both an "author" and a "committer", and each of those are three-part entities (name, email, date). Typically author and committer are the same but, when you apply a patch (eg from `git am`) they will differ. – torek Sep 11 '13 at 22:12
  • Also, the committer and author are the same. It's all me, all the time (mostly). It's just the author date is always the same. – Michael Johnson Sep 12 '13 at 03:31
  • Are you using stock git commands? Or some UI or aliases which silently add the `--date` option? – Slaven Rezic Sep 12 '13 at 06:53
  • Stock git, but also magit within Emacs. I'll do some test commits in and out of magit to see if there might be a clue there. – Michael Johnson Sep 12 '13 at 14:09
  • @SlavenRezic: It would seem that it's magit that's doing it. There's no direct option in magit that sets the commit time, though. So more research. – Michael Johnson Sep 12 '13 at 14:22
  • Maybe `GIT_AUTHOR_DATE` is set within the emacs process? What's the output of `M-x eval-expression (getenv "GIT_AUTHOR_DATE")`? – Slaven Rezic Sep 12 '13 at 15:53
  • @SlavenRezic: I don't know. But, I restarted Emacs and everything seems to be fine now. There's the outside chance that my emacs instance had been running since before the guilty date and somehow got confused. There's even the chance that I did a package update and just didn't restart emacs afterward. Thank you for your help! – Michael Johnson Sep 12 '13 at 19:54

2 Answers2

2

There is an environment variable called GIT_COMMITTER_DATE which can be used to override the current date for new commits. Try:

env | grep GIT

and see if that is set.

Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285
0

It appears there was something corrupt in the emacs process somewhere. It is quite possible that emacs had actually been running since before the date in question and had somehow become slightly corrupted.

Restarting emacs fixed the problem. I will, however, keep an eye on things, at least for awhile.

Thank you to those who helped me track down the problem. I hadn't realized how much I rely on magit.

Michael Johnson
  • 2,287
  • 16
  • 21