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
14949ba6
Commit
14949ba6
authored
Aug 30, 2018
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix path bug and update specs
parent
151361f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
app/services/projects/transfer_service.rb
app/services/projects/transfer_service.rb
+1
-1
spec/services/projects/transfer_service_spec.rb
spec/services/projects/transfer_service_spec.rb
+3
-2
No files found.
app/services/projects/transfer_service.rb
View file @
14949ba6
...
...
@@ -43,7 +43,7 @@ module Projects
@new_path
=
File
.
join
(
@new_namespace
.
try
(
:full_path
)
||
''
,
project
.
path
)
@old_namespace
=
project
.
namespace
if
Project
.
where
(
namespace_id:
@new_namespace
.
try
(
:id
)).
where
(
'path = ? or name = ?'
,
project
.
path
,
project
.
path
).
exists?
if
Project
.
where
(
namespace_id:
@new_namespace
.
try
(
:id
)).
where
(
'path = ? or name = ?'
,
project
.
path
,
project
.
name
).
exists?
raise
TransferError
.
new
(
"Project with same name or path in target namespace already exists"
)
end
...
...
spec/services/projects/transfer_service_spec.rb
View file @
14949ba6
...
...
@@ -172,8 +172,9 @@ describe Projects::TransferService do
context
'target namespace containing the same project name'
do
before
do
group
.
add_owner
(
user
)
project
.
update
(
name:
'new_name'
)
create
(
:project
,
name:
project
.
name
,
group:
group
,
path:
'other'
)
create
(
:project
,
name:
'new_name'
,
group:
group
,
path:
'other'
)
@result
=
transfer_project
(
project
,
user
,
group
)
end
...
...
@@ -187,7 +188,7 @@ describe Projects::TransferService do
before
do
group
.
add_owner
(
user
)
create
(
:project
,
name:
project
.
name
,
group:
group
)
create
(
:project
,
name:
'other-name'
,
path:
project
.
path
,
group:
group
)
@result
=
transfer_project
(
project
,
user
,
group
)
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