CreateChange: move out checks for "merge" field of the ChangeInput
This check is required for the input and can be done before lots of the above code being executed. Moving it to rejected early. Change-Id: I62ed7b18bfa441dc6d7addb06a105069932acd9d
This commit is contained in:
@@ -250,10 +250,6 @@ public class CreateChange
|
||||
RevCommit c;
|
||||
if (input.merge != null) {
|
||||
// create a merge commit
|
||||
if (!(submitType.equals(SubmitType.MERGE_ALWAYS)
|
||||
|| submitType.equals(SubmitType.MERGE_IF_NECESSARY))) {
|
||||
throw new BadRequestException("Submit type: " + submitType + " is not supported");
|
||||
}
|
||||
c = newMergeCommit(git, oi, rw, projectState, mergeTip, input.merge, author, commitMessage);
|
||||
} else {
|
||||
// create an empty commit
|
||||
@@ -342,6 +338,13 @@ public class CreateChange
|
||||
me.state().getGeneralPreferences().workInProgressByDefault, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (input.merge != null) {
|
||||
if (!(submitType.equals(SubmitType.MERGE_ALWAYS)
|
||||
|| submitType.equals(SubmitType.MERGE_IF_NECESSARY))) {
|
||||
throw new BadRequestException("Submit type: " + submitType + " is not supported");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkRequiredPermissions(Project.NameKey project, String refName)
|
||||
|
||||
Reference in New Issue
Block a user