Class CommitValidators
java.lang.Object
com.google.gerrit.server.git.validators.CommitValidators
Represents a list of
CommitValidationListeners to run for a push to one branch of one
project.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDon't allow the user to amend a merge created by Gerrit Code Review.static classRequire that author matches the uploader.static classReject banned commits.static classstatic classRequire that committer matches the uploader.static classIf this is the special project configuration branch, validate the config.static classstatic classRejects updates to group branches.static classRejects updates to projects that don't allow writes.static classstatic classRequire permission to upload merge commits. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic CommitValidationMessageinvalidEmail(String type, org.eclipse.jgit.lib.PersonIdent who, IdentifiedUser currentUser, UrlFormatter urlFormatter) invokeCommitValidationInfoListeners(boolean invokeCommitValidationInfoListeners) Whether theCommitValidationInfoListeners should be invoked after the validation is done.patchSet(PatchSet.Id patchSetId) Sets the patch set for which the validation is done.com.google.common.collect.ImmutableMap<String, CommitValidationInfo> validate(CommitReceivedEvent receiveEvent)
-
Field Details
-
NEW_PATCHSET_PATTERN
-
-
Method Details
-
patchSet
Sets the patch set for which the validation is done.If the validation is done for a commit that is not associated with a patch set (e.g. when commits are pushed directly, bypassing code-review) this method doesn't need to be called.
- Parameters:
patchSetId- the patch set for which the validation is done- Returns:
- the
CommitValidatorsinstance to allow chaining calls
-
invokeCommitValidationInfoListeners
@CanIgnoreReturnValue public CommitValidators invokeCommitValidationInfoListeners(boolean invokeCommitValidationInfoListeners) Whether theCommitValidationInfoListeners should be invoked after the validation is done.If invoking the
CommitValidationInfoListeners is skipped, it's the responsibility of the caller to invoke them later. For example, this makes sense when commits are validated and the information about the change/patch-set (seepatchSet(com.google.gerrit.entities.PatchSet.Id)is not available yet.- Parameters:
invokeCommitValidationInfoListeners- Whether theCommitValidationInfoListeners should be invoked after the validation is done.- Returns:
- the
CommitValidatorsinstance to allow chaining calls
-
validate
@CanIgnoreReturnValue public com.google.common.collect.ImmutableMap<String,CommitValidationInfo> validate(CommitReceivedEvent receiveEvent) throws CommitValidationException - Throws:
CommitValidationException
-
invalidEmail
public static CommitValidationMessage invalidEmail(String type, org.eclipse.jgit.lib.PersonIdent who, IdentifiedUser currentUser, UrlFormatter urlFormatter)
-