From 67389b9e7060b7f917a8383ec04d3a0c6bd24c5c Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Tue, 26 Nov 2013 08:47:57 -0500
Subject: [PATCH] Fix NPE when adding a permission without a registrant (issue-344)

---
 src/main/java/com/gitblit/git/GitblitReceivePack.java |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/gitblit/git/GitblitReceivePack.java b/src/main/java/com/gitblit/git/GitblitReceivePack.java
index e6ff572..ba200b2 100644
--- a/src/main/java/com/gitblit/git/GitblitReceivePack.java
+++ b/src/main/java/com/gitblit/git/GitblitReceivePack.java
@@ -120,6 +120,14 @@
 	@Override
 	public void onPreReceive(ReceivePack rp, Collection<ReceiveCommand> commands) {
 
+		if (repository.isMirror) {
+			// repository is a mirror
+			for (ReceiveCommand cmd : commands) {
+				sendRejection(cmd, "Gitblit does not allow pushes to \"{0}\" because it is a mirror!", repository.name);
+			}
+			return;
+		}
+
 		if (repository.isFrozen) {
 			// repository is frozen/readonly
 			for (ReceiveCommand cmd : commands) {

--
Gitblit v1.9.1