From 9c47959ece677eaaceb6f3d2eb42b0466f60acdc Mon Sep 17 00:00:00 2001 From: Markus Fömpe <markus.foempe@gmail.com> Date: Fri, 04 Jan 2013 06:03:09 -0500 Subject: [PATCH] Removed DoubleCheckedLocking from checkstyle.xml. Since Checkstyle 5.6 it's no longer supported (see http://checkstyle.sourceforge.net/releasenotes.html) --- src/com/gitblit/wicket/panels/BranchesPanel.java | 21 +++++++++++++++++++-- 1 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/com/gitblit/wicket/panels/BranchesPanel.java b/src/com/gitblit/wicket/panels/BranchesPanel.java index cfe9f5f..1262077 100644 --- a/src/com/gitblit/wicket/panels/BranchesPanel.java +++ b/src/com/gitblit/wicket/panels/BranchesPanel.java @@ -36,8 +36,10 @@ import com.gitblit.SyndicationServlet; import com.gitblit.models.RefModel; import com.gitblit.models.RepositoryModel; +import com.gitblit.models.UserModel; import com.gitblit.utils.JGitUtils; import com.gitblit.utils.StringUtils; +import com.gitblit.wicket.GitBlitWebSession; import com.gitblit.wicket.WicketUtils; import com.gitblit.wicket.pages.BranchesPage; import com.gitblit.wicket.pages.CommitPage; @@ -58,9 +60,24 @@ // branches List<RefModel> branches = new ArrayList<RefModel>(); - branches.addAll(JGitUtils.getLocalBranches(r, false, maxCount)); + UserModel user = GitBlitWebSession.get().getUser(); + if (user == null) { + user = UserModel.ANONYMOUS; + } + + List<RefModel> localBranches = JGitUtils.getLocalBranches(r, false, -1); + for (RefModel refModel : localBranches) { + if (user.canView(model, refModel.reference.getName())) { + branches.add(refModel); + } + } if (model.showRemoteBranches) { - branches.addAll(JGitUtils.getRemoteBranches(r, false, maxCount)); + List<RefModel> remoteBranches = JGitUtils.getRemoteBranches(r, false, -1); + for (RefModel refModel : remoteBranches) { + if (user.canView(model, refModel.reference.getName())) { + branches.add(refModel); + } + } } Collections.sort(branches); Collections.reverse(branches); -- Gitblit v1.9.1