From e4ffebc567f84d6ac730c1f3b044db65832f8f73 Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Sun, 01 Jan 2012 09:19:13 -0500 Subject: [PATCH] Fixed daysback on repositories page --- src/com/gitblit/utils/JGitUtils.java | 22 +++++++++++++++++++++- 1 files changed, 21 insertions(+), 1 deletions(-) diff --git a/src/com/gitblit/utils/JGitUtils.java b/src/com/gitblit/utils/JGitUtils.java index 31fd08f..d694ee2 100644 --- a/src/com/gitblit/utils/JGitUtils.java +++ b/src/com/gitblit/utils/JGitUtils.java @@ -471,6 +471,19 @@ } /** + * 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. * @@ -988,7 +1001,14 @@ RevWalk rw = new RevWalk(repository); rw.markStart(rw.parseCommit(endRange)); - rw.markUninteresting(rw.parseCommit(startRange)); + if (startRange.equals(ObjectId.zeroId())) { + // maybe this is a tag or an orphan branch + list.add(rw.parseCommit(endRange)); + rw.dispose(); + return list; + } else { + rw.markUninteresting(rw.parseCommit(startRange)); + } Iterable<RevCommit> revlog = rw; for (RevCommit rev : revlog) { -- Gitblit v1.9.1