From 234933ef14ca0ff2175235bc42bf1aa40040aa5d Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Fri, 27 Sep 2013 21:31:17 -0400
Subject: [PATCH] Merge receive processing into one class
---
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