Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a7f0160f
Commit
a7f0160f
authored
Nov 03, 2014
by
Valery Sizov
Committed by
Valery Sizov
Nov 03, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git hook: code style
parent
cc34c09e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
3 deletions
+8
-3
app/models/git_hook.rb
app/models/git_hook.rb
+4
-0
app/models/user.rb
app/models/user.rb
+1
-2
lib/gitlab/git_access.rb
lib/gitlab/git_access.rb
+3
-1
No files found.
app/models/git_hook.rb
View file @
a7f0160f
...
...
@@ -13,4 +13,8 @@ class GitHook < ActiveRecord::Base
true
end
end
def
commit_validation?
commit_message_regex
.
present?
||
author_email_regex
.
present?
||
member_check
end
end
app/models/user.rb
View file @
a7f0160f
...
...
@@ -214,8 +214,7 @@ class User < ActiveRecord::Base
end
def
existing_member?
(
email
)
!!
(
User
.
where
(
email:
email
).
first
||
User
.
joins
(
:emails
).
where
(
emails:
{
email:
email
}).
first
)
User
.
where
(
email:
email
).
any?
||
Email
.
where
(
email:
email
).
any?
end
def
filter
(
filter_name
)
...
...
lib/gitlab/git_access.rb
View file @
a7f0160f
...
...
@@ -109,12 +109,13 @@ module Gitlab
end
# Check commit messages unless its branch removal
if
(
git_hook
.
commit_message_regex
.
present?
||
git_hook
.
author_email_regex
.
present?
||
git_hook
.
member_check
)
&&
newrev
!~
/00000000/
if
git_hook
.
commit_validation?
&&
newrev
!~
/00000000/
commits
=
project
.
repository
.
commits_between
(
oldrev
,
newrev
)
commits
.
each
do
|
commit
|
if
git_hook
.
commit_message_regex
.
present?
return
false
unless
commit
.
safe_message
=~
Regexp
.
new
(
git_hook
.
commit_message_regex
)
end
if
git_hook
.
author_email_regex
.
present?
return
false
unless
commit
.
committer_email
=~
Regexp
.
new
(
git_hook
.
author_email_regex
)
return
false
unless
commit
.
author_email
=~
Regexp
.
new
(
git_hook
.
author_email_regex
)
...
...
@@ -156,5 +157,6 @@ module Gitlab
nil
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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