]> source.dussan.org Git - gitblit.git/commitdiff
Remove upload pack ref filtering
authorJames Moger <james.moger@gitblit.com>
Thu, 24 Oct 2013 18:59:29 +0000 (14:59 -0400)
committerJames Moger <james.moger@gitblit.com>
Fri, 25 Oct 2013 11:54:08 +0000 (07:54 -0400)
Change-Id: I7ffcbf00e70eea68803eb6c046d5ddca55503b8b

releases.moxie
src/main/java/com/gitblit/git/GitblitUploadPackFactory.java

index a48473dad923a5cf10b8a2dc3f138c77cf98de17..6dfb7446c43198c780ac6cbc977491341e6f16ac 100644 (file)
@@ -22,6 +22,7 @@ r20: {
        - Do not log passwords on failed authentication attempts (issue-316)
        - Updated default binary and Lucene ignore extensions
        - Change the WAR baseFolder context parameter to a JNDI env-entry to improve enterprise deployments
+       - Removed internal Gitblit ref exclusions in the upload pack
     additions:
        - Added branch graph image servlet based on EGit's branch graph renderer (issue-194)
        - Added option to render Markdown commit messages (issue-203)
index 01dfc08b0d08146e219ece2f392f0eabb9b90b1b..90875b59942681779ebc9eb9face146fc74ddf48 100644 (file)
  */
 package com.gitblit.git;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
 import javax.servlet.http.HttpServletRequest;
 
-import org.eclipse.jgit.lib.Ref;
 import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.transport.RefFilter;
 import org.eclipse.jgit.transport.UploadPack;
 import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException;
 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;
 
@@ -63,45 +56,9 @@ public class GitblitUploadPackFactory<X> implements UploadPackFactory<X> {
                        timeout = client.getDaemon().getTimeout();
                }
 
-               RefFilter refFilter = new UserRefFilter(user);
                UploadPack up = new UploadPack(db);
-               up.setRefFilter(refFilter);
                up.setTimeout(timeout);
 
                return up;
        }
-
-       /**
-        * Restricts advertisement of certain refs based on the permission of the
-        * requesting user.
-        */
-       public static class UserRefFilter implements RefFilter {
-
-               final UserModel user;
-
-               public UserRefFilter(UserModel user) {
-                       this.user = user;
-               }
-
-               @Override
-               public Map<String, Ref> filter(Map<String, Ref> refs) {
-                       if (user.canAdmin()) {
-                               // admins can see all refs
-                               return refs;
-                       }
-
-                       // 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