diff options
Diffstat (limited to 'gerrit-server/src/main/java/com/google/gerrit/server/git/validators/CommitValidators.java')
-rw-r--r-- | gerrit-server/src/main/java/com/google/gerrit/server/git/validators/CommitValidators.java | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/validators/CommitValidators.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/validators/CommitValidators.java index 8abe501cde..a57f9239fa 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/git/validators/CommitValidators.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/validators/CommitValidators.java @@ -22,6 +22,7 @@ import com.google.gerrit.server.config.CanonicalWebUrl; import com.google.gerrit.server.events.CommitReceivedEvent; import com.google.gerrit.server.git.GitRepositoryManager; import com.google.gerrit.server.git.ProjectConfig; +import com.google.gerrit.server.git.ReceiveCommits; import com.google.gerrit.server.git.ValidationError; import com.google.gerrit.server.project.ProjectControl; import com.google.gerrit.server.project.RefControl; @@ -47,7 +48,6 @@ import java.net.URL; import java.util.Collections; import java.util.LinkedList; import java.util.List; -import java.util.regex.Pattern; import javax.annotation.Nullable; @@ -57,9 +57,6 @@ public class CommitValidators { private static final FooterKey CHANGE_ID = new FooterKey("Change-Id"); - private static final Pattern NEW_PATCHSET = Pattern - .compile("^refs/changes/(?:[0-9][0-9])?(/[1-9][0-9]*){1,2}(?:/new)?$"); - public interface Factory { CommitValidators create(RefControl refControl, SshInfo sshInfo, Repository repo); @@ -99,7 +96,8 @@ public class CommitValidators { validators.add(new CommitterUploaderValidator(refControl, canonicalWebUrl)); validators.add(new SignedOffByValidator(refControl, canonicalWebUrl)); if (MagicBranch.isMagicBranch(receiveEvent.command.getRefName()) - || NEW_PATCHSET.matcher(receiveEvent.command.getRefName()).matches()) { + || ReceiveCommits.NEW_PATCHSET.matcher( + receiveEvent.command.getRefName()).matches()) { validators.add(new ChangeIdValidator(refControl, canonicalWebUrl, sshInfo)); } validators.add(new ConfigValidator(refControl, repo)); @@ -132,7 +130,8 @@ public class CommitValidators { validators.add(new AuthorUploaderValidator(refControl, canonicalWebUrl)); validators.add(new SignedOffByValidator(refControl, canonicalWebUrl)); if (MagicBranch.isMagicBranch(receiveEvent.command.getRefName()) - || NEW_PATCHSET.matcher(receiveEvent.command.getRefName()).matches()) { + || ReceiveCommits.NEW_PATCHSET.matcher( + receiveEvent.command.getRefName()).matches()) { validators.add(new ChangeIdValidator(refControl, canonicalWebUrl, sshInfo)); } validators.add(new ConfigValidator(refControl, repo)); |