BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
ea9e8f46
Commit
ea9e8f46
authored
Jul 07, 2016
by
Timothy Andrew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move all "checks" under `GitLab::Checks`.
-
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4892#note_12892160
- This is more consistent.
parent
4d00ed21
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
16 deletions
+16
-16
refresh_service.rb
app/services/merge_requests/refresh_service.rb
+1
-1
change_access.rb
lib/gitlab/checks/change_access.rb
+3
-5
force_push.rb
lib/gitlab/checks/force_push.rb
+11
-9
git_access.rb
lib/gitlab/git_access.rb
+1
-1
No files found.
app/services/merge_requests/refresh_service.rb
View file @
ea9e8f46
...
...
@@ -48,7 +48,7 @@ module MergeRequests
end
def
force_push?
Gitlab
::
ForcePushCheck
.
force_push?
(
@project
,
@oldrev
,
@newrev
)
Gitlab
::
Checks
::
ForcePush
.
force_push?
(
@project
,
@oldrev
,
@newrev
)
end
# Refresh merge request diff if we push to source or target branch of merge request
...
...
lib/gitlab/
git_access/change_access_check
.rb
→
lib/gitlab/
checks/change_access
.rb
View file @
ea9e8f46
module
Gitlab
class
GitAcces
s
class
ChangeAccess
Check
module
Check
s
class
ChangeAccess
attr_reader
:user_access
,
:project
def
initialize
(
change
,
user_access
:,
project
:)
...
...
@@ -25,8 +25,6 @@ module Gitlab
def
protected_branch_checks
return
unless
project
.
protected_branch?
(
@branch_name
)
return
unless
project
.
protected_branch?
(
@branch_name
)
if
forced_push?
&&
user_access
.
cannot_do_action?
(
:force_push_code_to_protected_branches
)
return
"You are not allowed to force push code to a protected branch on this project."
elsif
Gitlab
::
Git
.
blank_ref?
(
@newrev
)
&&
user_access
.
cannot_do_action?
(
:remove_protected_branches
)
...
...
@@ -67,7 +65,7 @@ module Gitlab
end
def
forced_push?
Gitlab
::
ForcePushCheck
.
force_push?
(
@project
,
@oldrev
,
@newrev
)
Gitlab
::
Checks
::
ForcePush
.
force_push?
(
@project
,
@oldrev
,
@newrev
)
end
def
matching_merge_request?
...
...
lib/gitlab/
force_push_check
.rb
→
lib/gitlab/
checks/force_push
.rb
View file @
ea9e8f46
module
Gitlab
class
ForcePushCheck
def
self
.
force_push?
(
project
,
oldrev
,
newrev
)
return
false
if
project
.
empty_repo?
module
Checks
class
ForcePush
def
self
.
force_push?
(
project
,
oldrev
,
newrev
)
return
false
if
project
.
empty_repo?
# Created or deleted branch
if
Gitlab
::
Git
.
blank_ref?
(
oldrev
)
||
Gitlab
::
Git
.
blank_ref?
(
newrev
)
false
else
missed_refs
,
_
=
Gitlab
::
Popen
.
popen
(
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
--git-dir=
#{
project
.
repository
.
path_to_repo
}
rev-list
#{
oldrev
}
^
#{
newrev
}
)
)
missed_refs
.
split
(
"
\n
"
).
size
>
0
# Created or deleted branch
if
Gitlab
::
Git
.
blank_ref?
(
oldrev
)
||
Gitlab
::
Git
.
blank_ref?
(
newrev
)
false
else
missed_refs
,
_
=
Gitlab
::
Popen
.
popen
(
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
--git-dir=
#{
project
.
repository
.
path_to_repo
}
rev-list
#{
oldrev
}
^
#{
newrev
}
)
)
missed_refs
.
split
(
"
\n
"
).
size
>
0
end
end
end
end
...
...
lib/gitlab/git_access.rb
View file @
ea9e8f46
...
...
@@ -91,7 +91,7 @@ module Gitlab
end
def
change_access_check
(
change
)
Ch
angeAccessCheck
.
new
(
change
,
user_access:
user_access
,
project:
project
).
exec
Ch
ecks
::
ChangeAccess
.
new
(
change
,
user_access:
user_access
,
project:
project
).
exec
end
def
protocol_allowed?
...
...
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