From 73d8e161834f768bc772e38a7ebf1a140962c685 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Mon, 30 Sep 2013 10:10:47 -0400
Subject: [PATCH] Add recursive delete function to FileUtils

---
 src/main/java/com/gitblit/git/GitblitUploadPackFactory.java |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/src/main/java/com/gitblit/git/GitblitUploadPackFactory.java b/src/main/java/com/gitblit/git/GitblitUploadPackFactory.java
index e953ca4..6c06fa3 100644
--- a/src/main/java/com/gitblit/git/GitblitUploadPackFactory.java
+++ b/src/main/java/com/gitblit/git/GitblitUploadPackFactory.java
@@ -15,6 +15,8 @@
  */
 package com.gitblit.git;
 
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
@@ -27,10 +29,9 @@
 import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;
 import org.eclipse.jgit.transport.resolver.UploadPackFactory;
 
+import com.gitblit.Constants;
 import com.gitblit.GitBlit;
 import com.gitblit.models.UserModel;
-import com.gitblit.utils.IssueUtils;
-import com.gitblit.utils.PushLogUtils;
 
 /**
  * The upload pack factory creates an upload pack which controls what refs are
@@ -89,10 +90,18 @@
 				return refs;
 			}
 
-			// normal users can not clone gitblit refs
-			refs.remove(IssueUtils.GB_ISSUES);
-			refs.remove(PushLogUtils.GB_PUSHES);
+			// normal users can not clone any gitblit refs
+			// JGit's RefMap is custom and does not support iterator removal :(
+			List<String> toRemove = new ArrayList<String>();
+			for (String ref : refs.keySet()) {
+				if (ref.startsWith(Constants.R_GITBLIT)) {
+					toRemove.add(ref);
+				}
+			}
+			for (String ref : toRemove) {
+				refs.remove(ref);
+			}
 			return refs;
 		}
 	}
-}
+}
\ No newline at end of file

--
Gitblit v1.9.1