Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 345488

Summary: RevCommit.getCommitTime() returns wrong date
Product: [Technology] JGit Reporter: ákos tajti <akos.tajti>
Component: JGitAssignee: Project Inbox <jgit.core-inbox>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: caniszczyk, sop
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description ákos tajti CLA 2011-05-11 15:18:52 EDT
Build Identifier: 

I have a commit that was created on May 05, 18:14. I see this correct date in the git log. However, if I parse the commit and call RevCommit.getCommitTime(), multiply it with 1000 and pass the value to the Date constructor I get May 6, 05:52. If I use RevCommit.getAuthorIdent().getWhen() I get the correct date.

Reproducible: Didn't try
Comment 1 Shawn Pearce CLA 2011-05-11 15:23:59 EDT
Sounds like your commit was amended? It is valid for the commit time to differ from the AuthorIdent as these are two different fields in the same commit object.

If you want us to look into the bug further, please provide the "author" and "committer" lines from the commit object's headers. You can read them by running `git cat-file commit COMMIT_SHA1` on the command line.
Comment 2 ákos tajti CLA 2011-05-11 15:33:09 EDT
The author and committer lines:

author zluspai <zoltan.luspai@intland.com> 1304612098 +0200
committer zluspai <zoltan.luspai@intland.com> 1304653950 +0200

The times are really different.

(In reply to comment #1)
> Sounds like your commit was amended? It is valid for the commit time to differ
> from the AuthorIdent as these are two different fields in the same commit
> object.
> 
> If you want us to look into the bug further, please provide the "author" and
> "committer" lines from the commit object's headers. You can read them by
> running `git cat-file commit COMMIT_SHA1` on the command line.