Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 345488 - RevCommit.getCommitTime() returns wrong date
Summary: RevCommit.getCommitTime() returns wrong date
Status: RESOLVED INVALID
Alias: None
Product: JGit
Classification: Technology
Component: JGit (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-11 15:18 EDT by ákos tajti CLA
Modified: 2011-05-11 15:33 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.