From 69007029f122c3f77db044e879188cc12be3c2f6 Mon Sep 17 00:00:00 2001
From: Florian Zschocke <florian.zschocke@cycos.com>
Date: Mon, 26 Aug 2013 06:39:57 -0400
Subject: [PATCH] Add method JGitUtils.createRepository(folder, name, shared) to create a new repository as if it was created with the --shared command line switch of git.

---
 src/main/java/com/gitblit/models/RefLogEntry.java |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/gitblit/models/RefLogEntry.java b/src/main/java/com/gitblit/models/RefLogEntry.java
index 54d1777..abfc56b 100644
--- a/src/main/java/com/gitblit/models/RefLogEntry.java
+++ b/src/main/java/com/gitblit/models/RefLogEntry.java
@@ -160,7 +160,24 @@
 		}
 		return null;
 	}
-	
+
+	/**
+	 * Adds a commit to the push entry object as long as the commit is not a
+	 * duplicate.
+	 * 
+	 * @param branch
+	 * @param commit
+	 * @return a RepositoryCommit, if one was added. Null if this is duplicate
+	 *         commit
+	 */
+	public RepositoryCommit addCommit(RepositoryCommit commit) {
+		if (commits.add(commit)) {
+			authorCount = -1;
+			return commit;
+		}
+		return null;
+	}
+
 	/**
 	 * Adds a a list of repository commits.  This is used to construct discrete
 	 * ref push log entries
@@ -313,6 +330,9 @@
 	}
 
 	public PersonIdent getAuthorIdent() {
+		if (getAuthorCount() == 1) {
+			return getCommits().get(0).getAuthorIdent();
+		}
 		return getCommitterIdent();
 	}
 

--
Gitblit v1.9.1