Merge branch 'stable-2.15'
* stable-2.15: Reset state flags on loadData calls ReceiveCommits: Fix NEW_PATCHSET regex pattern CreateChangeIT#createNewChangeSignedOffByFooter: Remove unnecessary assume CommitValidators: Always check for Change-Id in subject line AbstractPushForReview: Factor repeated code to setRequireChangeId method Bazel: Use rules_closure from HEAD Change-Id: Ifb35377d72c3f4bd085944f16a6a1264ecad2141
This commit is contained in:
@@ -82,7 +82,7 @@ public class CommitValidators {
|
||||
private static final Logger log = LoggerFactory.getLogger(CommitValidators.class);
|
||||
|
||||
public static final Pattern NEW_PATCHSET_PATTERN =
|
||||
Pattern.compile("^" + REFS_CHANGES + "(?:[0-9][0-9]/)?([1-9][0-9]*)(?:/new)?$");
|
||||
Pattern.compile("^" + REFS_CHANGES + "(?:[0-9][0-9]/)?([1-9][0-9]*)(?:/[1-9][0-9]*)?$");
|
||||
|
||||
@Singleton
|
||||
public static class Factory {
|
||||
@@ -291,15 +291,13 @@ public class CommitValidators {
|
||||
String sha1 = commit.abbreviate(RevId.ABBREV_LEN).name();
|
||||
|
||||
if (idList.isEmpty()) {
|
||||
String shortMsg = commit.getShortMessage();
|
||||
if (shortMsg.startsWith(CHANGE_ID_PREFIX)
|
||||
&& CHANGE_ID.matcher(shortMsg.substring(CHANGE_ID_PREFIX.length()).trim()).matches()) {
|
||||
String errMsg = String.format(MISSING_SUBJECT_MSG, sha1);
|
||||
throw new CommitValidationException(errMsg);
|
||||
}
|
||||
if (projectState.is(BooleanProjectConfig.REQUIRE_CHANGE_ID)) {
|
||||
String shortMsg = commit.getShortMessage();
|
||||
if (shortMsg.startsWith(CHANGE_ID_PREFIX)
|
||||
&& CHANGE_ID
|
||||
.matcher(shortMsg.substring(CHANGE_ID_PREFIX.length()).trim())
|
||||
.matches()) {
|
||||
String errMsg = String.format(MISSING_SUBJECT_MSG, sha1);
|
||||
throw new CommitValidationException(errMsg);
|
||||
}
|
||||
String errMsg = String.format(MISSING_CHANGE_ID_MSG, sha1);
|
||||
messages.add(getMissingChangeIdErrorMsg(errMsg, commit));
|
||||
throw new CommitValidationException(errMsg, messages);
|
||||
|
||||
Reference in New Issue
Block a user