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
a05f0a46
Commit
a05f0a46
authored
May 21, 2018
by
Mario de la Ossa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract EE-specific code from app/services/commits/create_service.rb
parent
b8670f18
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
7 deletions
+24
-7
app/services/commits/create_service.rb
app/services/commits/create_service.rb
+2
-7
ee/app/services/ee/commits/create_service.rb
ee/app/services/ee/commits/create_service.rb
+22
-0
No files found.
app/services/commits/create_service.rb
View file @
a05f0a46
module
Commits
class
CreateService
<
::
BaseService
prepend
EE
::
Commits
::
CreateService
ValidationError
=
Class
.
new
(
StandardError
)
ChangeError
=
Class
.
new
(
StandardError
)
...
...
@@ -37,7 +39,6 @@ module Commits
def
validate!
validate_permissions!
validate_repository_size!
validate_on_branch!
validate_branch_existance!
...
...
@@ -52,12 +53,6 @@ module Commits
end
end
def
validate_repository_size!
if
project
.
above_size_limit?
raise_error
(
Gitlab
::
RepositorySizeError
.
new
(
project
).
commit_error
)
end
end
def
validate_on_branch!
if
!
@start_project
.
empty_repo?
&&
!
@start_project
.
repository
.
branch_exists?
(
@start_branch
)
raise_error
(
'You can only create or edit files when you are on a branch'
)
...
...
ee/app/services/ee/commits/create_service.rb
0 → 100644
View file @
a05f0a46
module
EE
module
Commits
module
CreateService
extend
::
Gitlab
::
Utils
::
Override
private
override
:validate!
def
validate!
super
validate_repository_size!
end
def
validate_repository_size!
if
project
.
above_size_limit?
raise_error
(
Gitlab
::
RepositorySizeError
.
new
(
project
).
commit_error
)
end
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