@@ -28,6 +28,7 @@ r17: { | |||
- Ensure Redmine url is properly formatted (issue 223) | |||
- Use standard ServletRequestWrapper instead of custom wrapper (issue 224) | |||
- Switch commit message back to a pre and ensure that it is properly escaped when combined with commit message regex substitution (issue 242) | |||
- Improve NPE handling for hook script enumeration (issue-253) | |||
changes: | |||
- Improved error logging for servlet containers which provide a null contextFolder (issue 199) |
@@ -3009,7 +3009,9 @@ public class GitBlit implements ServletContextListener { | |||
if (repository != null) { | |||
for (String teamname : userService.getTeamnamesForRepositoryRole(repository.name)) { | |||
TeamModel team = userService.getTeamModel(teamname); | |||
scripts.addAll(team.preReceiveScripts); | |||
if (!ArrayUtils.isEmpty(team.preReceiveScripts)) { | |||
scripts.addAll(team.preReceiveScripts); | |||
} | |||
} | |||
} | |||
return new ArrayList<String>(scripts); | |||
@@ -3059,7 +3061,9 @@ public class GitBlit implements ServletContextListener { | |||
if (repository != null) { | |||
for (String teamname : userService.getTeamnamesForRepositoryRole(repository.name)) { | |||
TeamModel team = userService.getTeamModel(teamname); | |||
scripts.addAll(team.postReceiveScripts); | |||
if (!ArrayUtils.isEmpty(team.postReceiveScripts)) { | |||
scripts.addAll(team.postReceiveScripts); | |||
} | |||
} | |||
} | |||
return new ArrayList<String>(scripts); |
@@ -42,6 +42,7 @@ import com.gitblit.Keys; | |||
import com.gitblit.client.Translation; | |||
import com.gitblit.models.RepositoryModel; | |||
import com.gitblit.models.UserModel; | |||
import com.gitblit.utils.ArrayUtils; | |||
import com.gitblit.utils.ClientLogger; | |||
import com.gitblit.utils.JGitUtils; | |||
import com.gitblit.utils.PushLogUtils; | |||
@@ -170,7 +171,9 @@ public class ReceiveHook implements PreReceiveHook, PostReceiveHook { | |||
Set<String> scripts = new LinkedHashSet<String>(); | |||
scripts.addAll(GitBlit.self().getPreReceiveScriptsInherited(repository)); | |||
scripts.addAll(repository.preReceiveScripts); | |||
if (!ArrayUtils.isEmpty(repository.preReceiveScripts)) { | |||
scripts.addAll(repository.preReceiveScripts); | |||
} | |||
runGroovy(repository, user, commands, rp, scripts); | |||
for (ReceiveCommand cmd : commands) { | |||
if (!Result.NOT_ATTEMPTED.equals(cmd.getResult())) { | |||
@@ -262,7 +265,9 @@ public class ReceiveHook implements PreReceiveHook, PostReceiveHook { | |||
// run Groovy hook scripts | |||
Set<String> scripts = new LinkedHashSet<String>(); | |||
scripts.addAll(GitBlit.self().getPostReceiveScriptsInherited(repository)); | |||
scripts.addAll(repository.postReceiveScripts); | |||
if (!ArrayUtils.isEmpty(repository.postReceiveScripts)) { | |||
scripts.addAll(repository.postReceiveScripts); | |||
} | |||
runGroovy(repository, user, commands, rp, scripts); | |||
} | |||