Commit 4181b5bc authored by Greg Messner's avatar Greg Messner
Browse files

Mods to add support for commit_message_negative_regex (#575)

parent 4ab82214
...@@ -2510,10 +2510,13 @@ public class ProjectApi extends AbstractApi implements Constants { ...@@ -2510,10 +2510,13 @@ public class ProjectApi extends AbstractApi implements Constants {
* memberCheck (optional) - Restrict commits by author (email) to existing GitLab users * memberCheck (optional) - Restrict commits by author (email) to existing GitLab users
* preventSecrets (optional) - GitLab will reject any files that are likely to contain secrets * preventSecrets (optional) - GitLab will reject any files that are likely to contain secrets
* commitMessageRegex (optional) - All commit messages must match this, e.g. Fixed \d+\..* * commitMessageRegex (optional) - All commit messages must match this, e.g. Fixed \d+\..*
* commitMessageNegativeRegex (optional) - No commit message is allowed to match this, e.g. ssh\:\/\/
* branchNameRegex (optional) - All branch names must match this, e.g. `(feature * branchNameRegex (optional) - All branch names must match this, e.g. `(feature
* authorEmailRegex (optional) - All commit author emails must match this, e.g. @my-company.com$ * authorEmailRegex (optional) - All commit author emails must match this, e.g. @my-company.com$
* fileNameRegex (optional) - All committed filenames must not match this, e.g. `(jar * fileNameRegex (optional) - All committed filenames must not match this, e.g. `(jar
* maxFileSize (optional) - Maximum file size (MB * 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.
* rejectUnsignedCommits (optional) - Reject commit when it is not signed through GPG
*</code> *</code>
* *
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required * @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
...@@ -2527,6 +2530,7 @@ public class ProjectApi extends AbstractApi implements Constants { ...@@ -2527,6 +2530,7 @@ public class ProjectApi extends AbstractApi implements Constants {
.withParam("member_check", pushRule.getMemberCheck()) .withParam("member_check", pushRule.getMemberCheck())
.withParam("prevent_secrets", pushRule.getPreventSecrets()) .withParam("prevent_secrets", pushRule.getPreventSecrets())
.withParam("commit_message_regex", pushRule.getCommitMessageRegex()) .withParam("commit_message_regex", pushRule.getCommitMessageRegex())
.withParam("commit_message_negative_regex", pushRule.getCommitMessageNegativeRegex())
.withParam("branch_name_regex", pushRule.getBranchNameRegex()) .withParam("branch_name_regex", pushRule.getBranchNameRegex())
.withParam("author_email_regex", pushRule.getAuthorEmailRegex()) .withParam("author_email_regex", pushRule.getAuthorEmailRegex())
.withParam("file_name_regex", pushRule.getFileNameRegex()) .withParam("file_name_regex", pushRule.getFileNameRegex())
...@@ -2534,7 +2538,6 @@ public class ProjectApi extends AbstractApi implements Constants { ...@@ -2534,7 +2538,6 @@ public class ProjectApi extends AbstractApi implements Constants {
.withParam("commit_committer_check", pushRule.getCommitCommitterCheck()) .withParam("commit_committer_check", pushRule.getCommitCommitterCheck())
.withParam("reject_unsigned_commits", pushRule.getRejectUnsignedCommits()); .withParam("reject_unsigned_commits", pushRule.getRejectUnsignedCommits());
Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "push_rule"); Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "push_rule");
return (response.readEntity(PushRules.class)); return (response.readEntity(PushRules.class));
} }
...@@ -2551,10 +2554,13 @@ public class ProjectApi extends AbstractApi implements Constants { ...@@ -2551,10 +2554,13 @@ public class ProjectApi extends AbstractApi implements Constants {
* memberCheck (optional) - Restrict commits by author (email) to existing GitLab users * memberCheck (optional) - Restrict commits by author (email) to existing GitLab users
* preventSecrets (optional) - GitLab will reject any files that are likely to contain secrets * preventSecrets (optional) - GitLab will reject any files that are likely to contain secrets
* commitMessageRegex (optional) - All commit messages must match this, e.g. Fixed \d+\..* * commitMessageRegex (optional) - All commit messages must match this, e.g. Fixed \d+\..*
* commitMessageNegativeRegex (optional) - No commit message is allowed to match this, e.g. ssh\:\/\/
* branchNameRegex (optional) - All branch names must match this, e.g. `(feature * branchNameRegex (optional) - All branch names must match this, e.g. `(feature
* authorEmailRegex (optional) - All commit author emails must match this, e.g. @my-company.com$ * authorEmailRegex (optional) - All commit author emails must match this, e.g. @my-company.com$
* fileNameRegex (optional) - All committed filenames must not match this, e.g. `(jar * fileNameRegex (optional) - All committed filenames must not match this, e.g. `(jar
* maxFileSize (optional) - Maximum file size (MB * 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.
* rejectUnsignedCommits (optional) - Reject commit when it is not signed through GPG
*</code> *</code>
* *
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required * @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
...@@ -2568,6 +2574,7 @@ public class ProjectApi extends AbstractApi implements Constants { ...@@ -2568,6 +2574,7 @@ public class ProjectApi extends AbstractApi implements Constants {
.withParam("member_check", pushRule.getMemberCheck()) .withParam("member_check", pushRule.getMemberCheck())
.withParam("prevent_secrets", pushRule.getPreventSecrets()) .withParam("prevent_secrets", pushRule.getPreventSecrets())
.withParam("commit_message_regex", pushRule.getCommitMessageRegex()) .withParam("commit_message_regex", pushRule.getCommitMessageRegex())
.withParam("commit_message_negative_regex", pushRule.getCommitMessageNegativeRegex())
.withParam("branch_name_regex", pushRule.getBranchNameRegex()) .withParam("branch_name_regex", pushRule.getBranchNameRegex())
.withParam("author_email_regex", pushRule.getAuthorEmailRegex()) .withParam("author_email_regex", pushRule.getAuthorEmailRegex())
.withParam("file_name_regex", pushRule.getFileNameRegex()) .withParam("file_name_regex", pushRule.getFileNameRegex())
......
...@@ -9,6 +9,7 @@ public class PushRules { ...@@ -9,6 +9,7 @@ public class PushRules {
private Integer id; private Integer id;
private Integer projectId; private Integer projectId;
private String commitMessageRegex; private String commitMessageRegex;
private String commitMessageNegativeRegex;
private String branchNameRegex; private String branchNameRegex;
private Boolean denyDeleteTag; private Boolean denyDeleteTag;
private Date createdAt; private Date createdAt;
...@@ -54,6 +55,18 @@ public class PushRules { ...@@ -54,6 +55,18 @@ public class PushRules {
return (this); return (this);
} }
public String getCommitMessageNegativeRegex() {
return commitMessageNegativeRegex;
}
public void setCommitMessageNegativeRegex(String commitMessageNegativeRegex) {
this.commitMessageNegativeRegex = commitMessageNegativeRegex;
}
public PushRules withCommitMessageNegativeRegex(String commitMessageNegativeRegex) {
this.commitMessageNegativeRegex = commitMessageNegativeRegex;
return (this);
}
public String getBranchNameRegex() { public String getBranchNameRegex() {
return branchNameRegex; return branchNameRegex;
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
"id": 1, "id": 1,
"project_id": 3, "project_id": 3,
"commit_message_regex": "Fixes \\d +\\", "commit_message_regex": "Fixes \\d +\\",
"commit_message_negative_regex": "ssh\\:\/\/",
"branch_name_regex": "", "branch_name_regex": "",
"deny_delete_tag": false, "deny_delete_tag": false,
"created_at": "2012-10-12T17:04:47Z", "created_at": "2012-10-12T17:04:47Z",
...@@ -9,5 +10,7 @@ ...@@ -9,5 +10,7 @@
"prevent_secrets": false, "prevent_secrets": false,
"author_email_regex": "", "author_email_regex": "",
"file_name_regex": "", "file_name_regex": "",
"max_file_size": 5 "max_file_size": 5,
"commit_committer_check": false,
"reject_unsigned_commits": false
} }
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment