From cecc39dc68387d5ac679f9f66047510dcec1ec6a Mon Sep 17 00:00:00 2001 From: James Moger Date: Wed, 12 Mar 2014 21:59:08 -0400 Subject: [PATCH] Fix watch list verification on push --- .../java/com/gitblit/git/PatchsetReceivePack.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gitblit/git/PatchsetReceivePack.java b/src/main/java/com/gitblit/git/PatchsetReceivePack.java index d3d0b1df..697b8b9e 100644 --- a/src/main/java/com/gitblit/git/PatchsetReceivePack.java +++ b/src/main/java/com/gitblit/git/PatchsetReceivePack.java @@ -350,6 +350,9 @@ public class PatchsetReceivePack extends GitblitReceivePack { continue; } + LOGGER.info(MessageFormat.format("Verifying {0} push ref \"{1}\" received from {2}", + repository.name, cmd.getRefName(), user.username)); + // responsible verification String responsible = PatchsetCommand.getSingleOption(cmd, PatchsetCommand.RESPONSIBLE); if (!StringUtils.isEmpty(responsible)) { @@ -380,14 +383,19 @@ public class PatchsetReceivePack extends GitblitReceivePack { // watcher verification List watchers = PatchsetCommand.getOptions(cmd, PatchsetCommand.WATCH); if (!ArrayUtils.isEmpty(watchers)) { + boolean verified = true; for (String watcher : watchers) { UserModel user = gitblit.getUserModel(watcher); if (user == null) { // watcher does not exist sendRejection(cmd, "Sorry, \"{0}\" is not a valid username for the watch list!", watcher); - continue; + verified = false; + break; } } + if (!verified) { + continue; + } } patchsetRefCmd = cmd; @@ -484,8 +492,6 @@ public class PatchsetReceivePack extends GitblitReceivePack { * @return the patchset command */ private PatchsetCommand preparePatchset(ReceiveCommand cmd) { - LOGGER.info(MessageFormat.format("Preparing {0} patchset command for \"{1}\" received from {2}", - repository.name, cmd.getRefName(), user.username)); String branch = getIntegrationBranch(cmd.getRefName()); long number = getTicketId(cmd.getRefName()); -- 2.39.5