From 6f8ad9b1068e57062a5f79da83c10ee715d412ef Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Fri, 21 Dec 2012 16:49:04 -0500
Subject: [PATCH] Fixed cache bug wrt create/edit repository with existing repo name (issue-172)

---
 groovy/sendmail-html.groovy |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/groovy/sendmail-html.groovy b/groovy/sendmail-html.groovy
index e0cdecd..1692073 100644
--- a/groovy/sendmail-html.groovy
+++ b/groovy/sendmail-html.groovy
@@ -370,14 +370,15 @@
         formatter.setDiffComparator(RawTextComparator.DEFAULT);
 
         def diffs
-        RevWalk rw = new RevWalk(repository);
+		RevWalk rw = new RevWalk(repository)
         if (commit.parentCount > 0) {
-            RevCommit parent = commit.parents[0]
+			RevCommit parent = rw.parseCommit(commit.parents[0].id)
             diffs = formatter.scan(parent.tree, commit.tree)
         } else {
             diffs = formatter.scan(new EmptyTreeIterator(),
                                    new CanonicalTreeParser(null, rw.objectReader, commit.tree))
         }
+		rw.dispose()
         // Write status table
         builder.table('class':"plain") {
             tbody() {

--
Gitblit v1.9.1