Merge branch 'stable-2.16' into stable-3.0
* stable-2.16: ReceiveCommits: Don't instantiate BranchCommitValidator repeatedly PermissionRange: Interpret allowMin > allowMax as disallow Change-Id: Ia18620a2e4daba4dcd4519cb3d3670a87e229ef2
This commit is contained in:
@@ -70,8 +70,8 @@ public class PermissionRange implements Comparable<PermissionRange> {
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
} else {
|
||||
this.min = max;
|
||||
this.max = min;
|
||||
this.min = 0;
|
||||
this.max = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3084,6 +3084,7 @@ class ReceiveCommits {
|
||||
}
|
||||
}
|
||||
|
||||
BranchCommitValidator validator = commitValidatorFactory.create(projectState, branch, user);
|
||||
RevWalk walk = receivePack.getRevWalk();
|
||||
walk.reset();
|
||||
walk.sort(RevSort.NONE);
|
||||
@@ -3110,7 +3111,6 @@ class ReceiveCommits {
|
||||
continue;
|
||||
}
|
||||
|
||||
BranchCommitValidator validator = commitValidatorFactory.create(projectState, branch, user);
|
||||
if (!validator.validCommit(
|
||||
walk.getObjectReader(), cmd, c, false, messages, rejectCommits, null, skipValidation)) {
|
||||
break;
|
||||
|
||||
@@ -563,6 +563,16 @@ public class RefControlTest extends GerritBaseTests {
|
||||
assertCannotUpdate("refs/tags/V10", u);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void blockPartialRangeLocally() {
|
||||
block(local, LABEL + "Code-Review", +1, +2, DEVS, "refs/heads/master");
|
||||
|
||||
ProjectControl u = user(local, DEVS);
|
||||
|
||||
PermissionRange range = u.controlForRef("refs/heads/master").getRange(LABEL + "Code-Review");
|
||||
assertCannotVote(2, range);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void blockLabelRange_ParentBlocksChild() {
|
||||
allow(local, LABEL + "Code-Review", -2, +2, DEVS, "refs/heads/*");
|
||||
|
||||
Reference in New Issue
Block a user