From 5e010729291f732d4f31cbf66649dbac1e795a59 Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Fri, 27 Jul 2012 21:41:26 -0400 Subject: [PATCH] Fixes to relative path determination for symlinks (issue 116) --- src/com/gitblit/client/GitblitClient.java | 28 ++++++++++++++++++++++------ 1 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/com/gitblit/client/GitblitClient.java b/src/com/gitblit/client/GitblitClient.java index d37ee91..ed5a133 100644 --- a/src/com/gitblit/client/GitblitClient.java +++ b/src/com/gitblit/client/GitblitClient.java @@ -28,6 +28,7 @@ import java.util.TreeSet; import com.gitblit.Constants; +import com.gitblit.Constants.AccessRestrictionType; import com.gitblit.GitBlitException.ForbiddenException; import com.gitblit.GitBlitException.NotAllowedException; import com.gitblit.GitBlitException.UnauthorizedException; @@ -41,6 +42,7 @@ import com.gitblit.models.ServerStatus; import com.gitblit.models.TeamModel; import com.gitblit.models.UserModel; +import com.gitblit.utils.ArrayUtils; import com.gitblit.utils.RpcUtils; import com.gitblit.utils.StringUtils; import com.gitblit.utils.SyndicationUtils; @@ -184,6 +186,14 @@ return sb.toString(); } } + + public AccessRestrictionType getDefaultAccessRestriction() { + String restriction = null; + if (settings.hasKey(Keys.git.defaultAccessRestriction)) { + restriction = settings.get(Keys.git.defaultAccessRestriction).currentValue; + } + return AccessRestrictionType.fromName(restriction); + } /** * Returns the list of pre-receive scripts the repository inherited from the @@ -208,7 +218,9 @@ if (repository != null) { for (String teamname : getPermittedTeamnames(repository)) { TeamModel team = getTeamModel(teamname); - scripts.addAll(team.preReceiveScripts); + if (!ArrayUtils.isEmpty(team.preReceiveScripts)) { + scripts.addAll(team.preReceiveScripts); + } } } return new ArrayList<String>(scripts); @@ -258,7 +270,9 @@ if (repository != null) { for (String teamname : getPermittedTeamnames(repository)) { TeamModel team = getTeamModel(teamname); - scripts.addAll(team.postReceiveScripts); + if (!ArrayUtils.isEmpty(team.postReceiveScripts)) { + scripts.addAll(team.postReceiveScripts); + } } } return new ArrayList<String>(scripts); @@ -278,9 +292,11 @@ // create list of available scripts by excluding inherited scripts List<String> scripts = new ArrayList<String>(); - for (String script : settings.pushScripts) { - if (!inherited.contains(script)) { - scripts.add(script); + if (!ArrayUtils.isEmpty(settings.pushScripts)) { + for (String script : settings.pushScripts) { + if (!inherited.contains(script)) { + scripts.add(script); + } } } return scripts; @@ -489,7 +505,7 @@ } return teamnames; } - + public TeamModel getTeamModel(String name) { for (TeamModel team : allTeams) { if (team.name.equalsIgnoreCase(name)) { -- Gitblit v1.9.1