Make project state check in FORCE_UPDATE explicit

The majority of code in {Project,Ref,Change}Control is now about
permissions, but not all. Exceptions include checks for a project's
state. This is confusing, because users are presented with an exception
telling them that they lack some kind of permission while the real
reason for the failed operation is that the project's current state
doesn't permit the operation.

This is part of a series of commits to remove all project state checks
from *Control classes and make explicit checks instead.

Change-Id: Ic497f0bbd6c0c128d3df81be34c382bba1a0d1b0
This commit is contained in:
Patrick Hiesel
2018-01-12 11:08:51 +01:00
parent b5bea5a554
commit 3ea2679096
2 changed files with 3 additions and 4 deletions

View File

@@ -1159,6 +1159,9 @@ class ReceiveCommits {
if (!validRefOperation(cmd)) {
return;
}
if (!projectState.statePermitsWrite()) {
cmd.setResult(REJECTED_NONFASTFORWARD, " project state does not permit write.");
}
actualCommands.add(cmd);
} else {
cmd.setResult(