Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
4181b5bc
Commit
4181b5bc
authored
May 17, 2020
by
Greg Messner
Browse files
Mods to add support for commit_message_negative_regex (#575)
parent
4ab82214
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/ProjectApi.java
View file @
4181b5bc
...
...
@@ -2510,10 +2510,13 @@ public class ProjectApi extends AbstractApi implements Constants {
* memberCheck (optional) - Restrict commits by author (email) to existing GitLab users
* 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+\..*
* commitMessageNegativeRegex (optional) - No commit message is allowed to match this, e.g. ssh\:\/\/
* 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$
* 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>
*
* @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 {
.
withParam
(
"member_check"
,
pushRule
.
getMemberCheck
())
.
withParam
(
"prevent_secrets"
,
pushRule
.
getPreventSecrets
())
.
withParam
(
"commit_message_regex"
,
pushRule
.
getCommitMessageRegex
())
.
withParam
(
"commit_message_negative_regex"
,
pushRule
.
getCommitMessageNegativeRegex
())
.
withParam
(
"branch_name_regex"
,
pushRule
.
getBranchNameRegex
())
.
withParam
(
"author_email_regex"
,
pushRule
.
getAuthorEmailRegex
())
.
withParam
(
"file_name_regex"
,
pushRule
.
getFileNameRegex
())
...
...
@@ -2534,7 +2538,6 @@ public class ProjectApi extends AbstractApi implements Constants {
.
withParam
(
"commit_committer_check"
,
pushRule
.
getCommitCommitterCheck
())
.
withParam
(
"reject_unsigned_commits"
,
pushRule
.
getRejectUnsignedCommits
());
Response
response
=
post
(
Response
.
Status
.
CREATED
,
formData
,
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"push_rule"
);
return
(
response
.
readEntity
(
PushRules
.
class
));
}
...
...
@@ -2551,10 +2554,13 @@ public class ProjectApi extends AbstractApi implements Constants {
* memberCheck (optional) - Restrict commits by author (email) to existing GitLab users
* 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+\..*
* commitMessageNegativeRegex (optional) - No commit message is allowed to match this, e.g. ssh\:\/\/
* 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$
* 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>
*
* @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 {
.
withParam
(
"member_check"
,
pushRule
.
getMemberCheck
())
.
withParam
(
"prevent_secrets"
,
pushRule
.
getPreventSecrets
())
.
withParam
(
"commit_message_regex"
,
pushRule
.
getCommitMessageRegex
())
.
withParam
(
"commit_message_negative_regex"
,
pushRule
.
getCommitMessageNegativeRegex
())
.
withParam
(
"branch_name_regex"
,
pushRule
.
getBranchNameRegex
())
.
withParam
(
"author_email_regex"
,
pushRule
.
getAuthorEmailRegex
())
.
withParam
(
"file_name_regex"
,
pushRule
.
getFileNameRegex
())
...
...
src/main/java/org/gitlab4j/api/models/PushRules.java
View file @
4181b5bc
...
...
@@ -9,6 +9,7 @@ public class PushRules {
private
Integer
id
;
private
Integer
projectId
;
private
String
commitMessageRegex
;
private
String
commitMessageNegativeRegex
;
private
String
branchNameRegex
;
private
Boolean
denyDeleteTag
;
private
Date
createdAt
;
...
...
@@ -54,6 +55,18 @@ public class PushRules {
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
()
{
return
branchNameRegex
;
}
...
...
src/test/resources/org/gitlab4j/api/push-rule.json
View file @
4181b5bc
...
...
@@ -2,6 +2,7 @@
"id"
:
1
,
"project_id"
:
3
,
"commit_message_regex"
:
"Fixes
\\
d +
\\
"
,
"commit_message_negative_regex"
:
"ssh
\\
:
\/\/
"
,
"branch_name_regex"
:
""
,
"deny_delete_tag"
:
false
,
"created_at"
:
"2012-10-12T17:04:47Z"
,
...
...
@@ -9,5 +10,7 @@
"prevent_secrets"
:
false
,
"author_email_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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment