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
2df26509
Commit
2df26509
authored
Dec 04, 2019
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename design repository if exists
parent
84276bb7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
1 deletion
+58
-1
ee/app/services/geo/move_repository_service.rb
ee/app/services/geo/move_repository_service.rb
+34
-1
ee/spec/services/geo/move_repository_service_spec.rb
ee/spec/services/geo/move_repository_service_spec.rb
+24
-0
No files found.
ee/app/services/geo/move_repository_service.rb
View file @
2df26509
...
...
@@ -45,6 +45,11 @@ module Geo
return
false
end
if
project
.
design_repository
.
exists?
&&
!
move_design_repository
log_error
(
'Design repository cannot be moved'
)
return
false
end
true
rescue
=>
ex
log_error
(
'Repository cannot be moved'
,
error:
ex
)
...
...
@@ -56,7 +61,35 @@ module Geo
end
def
move_wiki_repository
gitlab_shell
.
mv_repository
(
project
.
repository_storage
,
"
#{
old_disk_path
}
.wiki"
,
"
#{
new_disk_path
}
.wiki"
)
gitlab_shell
.
mv_repository
(
project
.
repository_storage
,
old_wiki_disk_path
,
new_wiki_disk_path
)
end
def
move_design_repository
gitlab_shell
.
mv_repository
(
project
.
repository_storage
,
old_design_disk_path
,
new_design_disk_path
)
end
def
wiki_path_suffix
Gitlab
::
GlRepository
::
WIKI
.
path_suffix
end
def
old_wiki_disk_path
"
#{
old_disk_path
}#{
wiki_path_suffix
}
"
end
def
new_wiki_disk_path
"
#{
new_disk_path
}#{
wiki_path_suffix
}
"
end
def
design_path_suffix
EE
::
Gitlab
::
GlRepository
::
DESIGN
.
path_suffix
end
def
old_design_disk_path
"
#{
old_disk_path
}#{
design_path_suffix
}
"
end
def
new_design_disk_path
"
#{
new_disk_path
}#{
design_path_suffix
}
"
end
end
end
ee/spec/services/geo/move_repository_service_spec.rb
View file @
2df26509
...
...
@@ -59,6 +59,30 @@ describe Geo::MoveRepositoryService, :geo do
expect
(
service
.
execute
).
to
eq
false
end
context
'when design repository exists'
do
before
do
project
.
design_repository
.
create_if_not_exists
end
it
'returns false when design repository can not be renamed'
do
allow_any_instance_of
(
Gitlab
::
Shell
).
to
receive
(
:mv_repository
)
.
with
(
project
.
repository_storage
,
old_path
,
new_path
)
.
and_return
(
true
)
allow_any_instance_of
(
Gitlab
::
Shell
).
to
receive
(
:mv_repository
)
.
with
(
project
.
repository_storage
,
"
#{
old_path
}
.wiki"
,
"
#{
new_path
}
.wiki"
)
.
and_return
(
true
)
allow_any_instance_of
(
Gitlab
::
Shell
).
to
receive
(
:mv_repository
)
.
with
(
project
.
repository_storage
,
"
#{
old_path
}
.design"
,
"
#{
new_path
}
.design"
)
.
and_return
(
false
)
expect
(
service
).
to
receive
(
:log_error
).
with
(
'Design repository cannot be moved'
)
expect
(
service
.
execute
).
to
eq
false
end
end
context
'wiki disabled'
do
let
(
:project
)
{
create
(
:project
,
:repository
,
:wiki_disabled
,
:legacy_storage
)
}
...
...
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