James Moger
2013-09-30 235ad956fa84cad4fac1b2e69a0c9e4f50376ea3
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;
      }
   }
}
}