Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions gitlab4j-api/src/main/java/org/gitlab4j/api/ProjectApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -3171,7 +3171,9 @@ public PushRules getPushRules(Object projectIdOrPath) throws GitLabApiException
* fileNameRegex (optional) - All committed filenames must not match this, e.g. `(jar
* maxFileSize (optional) - Maximum file size (MB)
* commitCommitterCheck (optional) - Users can only push commits to this repository that were committed with one of their own verified emails.
* commitCommitterNameCheck (optional) - Users can only push commits to this repository if the commit author name is consistent with their GitLab account name.
* rejectUnsignedCommits (optional) - Reject commit when it is not signed through GPG
* rejectNonDcoCommits (optional) - Reject commit when it is not DCO certified
*</code>
*
* @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required
Expand All @@ -3191,7 +3193,9 @@ public PushRules createPushRules(Object projectIdOrPath, PushRules pushRule) thr
.withParam("file_name_regex", pushRule.getFileNameRegex())
.withParam("max_file_size", pushRule.getMaxFileSize())
.withParam("commit_committer_check", pushRule.getCommitCommitterCheck())
.withParam("reject_unsigned_commits", pushRule.getRejectUnsignedCommits());
.withParam("commit_committer_name_check", pushRule.getCommitCommitterNameChack())
.withParam("reject_unsigned_commits", pushRule.getRejectUnsignedCommits())
.withParam("reject_non_dco_commits", pushRule.getRejectNonDcoCommits());

Response response =
post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "push_rule");
Expand All @@ -3216,7 +3220,9 @@ public PushRules createPushRules(Object projectIdOrPath, PushRules pushRule) thr
* fileNameRegex (optional) - All committed filenames must not match this, e.g. `(jar
* maxFileSize (optional) - Maximum file size (MB)
* commitCommitterCheck (optional) - Users can only push commits to this repository that were committed with one of their own verified emails.
* commitCommitterNameCheck (optional) - Users can only push commits to this repository if the commit author name is consistent with their GitLab account name.
* rejectUnsignedCommits (optional) - Reject commit when it is not signed through GPG
* rejectNonDcoCommits (optional) - Reject commit when it is not DCO certified
*</code>
*
* @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required
Expand All @@ -3236,7 +3242,9 @@ public PushRules updatePushRules(Object projectIdOrPath, PushRules pushRule) thr
.withParam("file_name_regex", pushRule.getFileNameRegex())
.withParam("max_file_size", pushRule.getMaxFileSize())
.withParam("commit_committer_check", pushRule.getCommitCommitterCheck())
.withParam("reject_unsigned_commits", pushRule.getRejectUnsignedCommits());
.withParam("commit_committer_name_check", pushRule.getCommitCommitterNameChack())
.withParam("reject_unsigned_commits", pushRule.getRejectUnsignedCommits())
.withParam("reject_non_dco_commits", pushRule.getRejectNonDcoCommits());

final Response response = putWithFormData(
Response.Status.OK, formData, "projects", getProjectIdOrPath(projectIdOrPath), "push_rule");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class PushRules implements Serializable {
private Boolean commitCommitterCheck;
private Boolean commitCommitterNameCheck;
private Boolean rejectUnsignedCommits;
private Boolean rejectNonDcoCommits;

public Long getId() {
return id;
Expand Down Expand Up @@ -182,6 +183,11 @@ public void setCommitCommitterNameCheck(Boolean commitCommitterNameCheck) {
this.commitCommitterNameCheck = commitCommitterNameCheck;
}

public PushRules withCommitCommitterNameCheck(Boolean commitCommitterNameCheck) {
this.commitCommitterNameCheck = commitCommitterNameCheck;
return (this);
}

public void setCommitCommitterCheck(Boolean commitCommitterCheck) {
this.commitCommitterCheck = commitCommitterCheck;
}
Expand All @@ -204,6 +210,19 @@ public PushRules withRejectUnsignedCommits(Boolean rejectUnsignedCommits) {
return (this);
}

public Boolean getRejectNonDcoCommits() {
return rejectNonDcoCommits;
}

public void setRejectNonDcoCommits(Boolean rejectUnsignedCommits) {
this.rejectNonDcoCommits = rejectNonDcoCommits;
}

public PushRules withRejectNonDcoCommits(Boolean rejectNonDcoCommits) {
this.rejectNonDcoCommits = rejectNonDcoCommits;
return (this);
}

@Override
public String toString() {
return (JacksonJson.toJsonString(this));
Expand Down