ReceiveCommits: Don't instantiate BranchCommitValidator repeatedly

Change-Id: Ifd842896a369af9d7ffe04885d62e8d2c203faaa
This commit is contained in:
David Pursehouse
2019-06-27 16:51:26 +09:00
parent e7b44a3fbe
commit 1014b5afa8

View File

@@ -3033,6 +3033,7 @@ class ReceiveCommits {
}
}
BranchCommitValidator validator = commitValidatorFactory.create(projectState, branch, user);
RevWalk walk = receivePack.getRevWalk();
walk.reset();
walk.sort(RevSort.NONE);
@@ -3059,7 +3060,6 @@ class ReceiveCommits {
continue;
}
BranchCommitValidator validator = commitValidatorFactory.create(projectState, branch, user);
if (!validator.validCommit(
walk.getObjectReader(), cmd, c, false, messages, rejectCommits, null, skipValidation)) {
break;