From 098bcda8640dbbe317aad6509e1dbc156d1ddd93 Mon Sep 17 00:00:00 2001 From: James Moger Date: Thu, 22 Dec 2011 16:20:56 -0500 Subject: Improved readability of generated email notifications --- src/com/gitblit/utils/JGitUtils.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/com/gitblit/utils') diff --git a/src/com/gitblit/utils/JGitUtils.java b/src/com/gitblit/utils/JGitUtils.java index 31fd08ff..e73ee800 100644 --- a/src/com/gitblit/utils/JGitUtils.java +++ b/src/com/gitblit/utils/JGitUtils.java @@ -470,6 +470,19 @@ public class JGitUtils { return new Date(commit.getCommitTime() * 1000L); } + /** + * Retrieves a Java Date from a Git commit. + * + * @param commit + * @return date of the commit or Date(0) if the commit is null + */ + public static Date getAuthorDate(RevCommit commit) { + if (commit == null) { + return new Date(0); + } + return commit.getAuthorIdent().getWhen(); + } + /** * Returns the specified commit from the repository. If the repository does * not exist or is empty, null is returned. -- cgit v1.2.3