]> source.dussan.org Git - gitblit.git/commitdiff
Fix watch list verification on push 29/29/1
authorJames Moger <james.moger@gitblit.com>
Thu, 13 Mar 2014 01:59:08 +0000 (21:59 -0400)
committerJames Moger <james.moger@gitblit.com>
Thu, 13 Mar 2014 01:59:08 +0000 (21:59 -0400)
src/main/java/com/gitblit/git/PatchsetReceivePack.java

index d3d0b1df46df8123881cb8e281dbf6fde06c5c43..697b8b9ea297f8ed691ef90d23442896100b522c 100644 (file)
@@ -350,6 +350,9 @@ public class PatchsetReceivePack extends GitblitReceivePack {
                                        continue;\r
                                }\r
 \r
+                               LOGGER.info(MessageFormat.format("Verifying {0} push ref \"{1}\" received from {2}",\r
+                                               repository.name, cmd.getRefName(), user.username));\r
+\r
                                // responsible verification\r
                                String responsible = PatchsetCommand.getSingleOption(cmd, PatchsetCommand.RESPONSIBLE);\r
                                if (!StringUtils.isEmpty(responsible)) {\r
@@ -380,14 +383,19 @@ public class PatchsetReceivePack extends GitblitReceivePack {
                                // watcher verification\r
                                List<String> watchers = PatchsetCommand.getOptions(cmd, PatchsetCommand.WATCH);\r
                                if (!ArrayUtils.isEmpty(watchers)) {\r
+                                       boolean verified = true;\r
                                        for (String watcher : watchers) {\r
                                                UserModel user = gitblit.getUserModel(watcher);\r
                                                if (user == null) {\r
                                                        // watcher does not exist\r
                                                        sendRejection(cmd, "Sorry, \"{0}\" is not a valid username for the watch list!", watcher);\r
-                                                       continue;\r
+                                                       verified = false;\r
+                                                       break;\r
                                                }\r
                                        }\r
+                                       if (!verified) {\r
+                                               continue;\r
+                                       }\r
                                }\r
 \r
                                patchsetRefCmd = cmd;\r
@@ -484,8 +492,6 @@ public class PatchsetReceivePack extends GitblitReceivePack {
         * @return the patchset command\r
         */\r
        private PatchsetCommand preparePatchset(ReceiveCommand cmd) {\r
-               LOGGER.info(MessageFormat.format("Preparing {0} patchset command for \"{1}\" received from {2}",\r
-                               repository.name, cmd.getRefName(), user.username));\r
                String branch = getIntegrationBranch(cmd.getRefName());\r
                long number = getTicketId(cmd.getRefName());\r
 \r