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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
cf677378
Commit
cf677378
authored
Dec 08, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prefer repository.branch_exists?
parent
4f94053c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
app/services/files/base_service.rb
app/services/files/base_service.rb
+3
-3
No files found.
app/services/files/base_service.rb
View file @
cf677378
...
@@ -5,7 +5,7 @@ module Files
...
@@ -5,7 +5,7 @@ module Files
def
execute
def
execute
@source_project
=
params
[
:source_project
]
||
@project
@source_project
=
params
[
:source_project
]
||
@project
@source_branch
=
params
[
:source_branch
]
@source_branch
=
params
[
:source_branch
]
@target_branch
=
params
[
:target_branch
]
@target_branch
=
params
[
:target_branch
]
@commit_message
=
params
[
:commit_message
]
@commit_message
=
params
[
:commit_message
]
@file_path
=
params
[
:file_path
]
@file_path
=
params
[
:file_path
]
...
@@ -59,12 +59,12 @@ module Files
...
@@ -59,12 +59,12 @@ module Files
end
end
unless
project
.
empty_repo?
unless
project
.
empty_repo?
unless
@source_project
.
repository
.
branch_
names
.
include
?
(
@source_branch
)
unless
@source_project
.
repository
.
branch_
exists
?
(
@source_branch
)
raise_error
(
'You can only create or edit files when you are on a branch'
)
raise_error
(
'You can only create or edit files when you are on a branch'
)
end
end
if
different_branch?
if
different_branch?
if
repository
.
branch_
names
.
include
?
(
@target_branch
)
if
repository
.
branch_
exists
?
(
@target_branch
)
raise_error
(
'Branch with such name already exists. You need to switch to this branch in order to make changes'
)
raise_error
(
'Branch with such name already exists. You need to switch to this branch in order to make changes'
)
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