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
b805c2d7
Commit
b805c2d7
authored
Mar 22, 2018
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Geo] Fix project rename when wiki does not exist
parent
87f19344
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
2 deletions
+45
-2
ee/app/services/geo/move_repository_service.rb
ee/app/services/geo/move_repository_service.rb
+18
-2
ee/changelogs/unreleased/geo-fix-wiki-moving.yml
ee/changelogs/unreleased/geo-fix-wiki-moving.yml
+5
-0
ee/spec/services/geo/move_repository_service_spec.rb
ee/spec/services/geo/move_repository_service_spec.rb
+22
-0
No files found.
ee/app/services/geo/move_repository_service.rb
View file @
b805c2d7
...
...
@@ -29,9 +29,25 @@ module Geo
def
move_repositories!
project
.
ensure_storage_path_exists
move_project_repository
&&
move_wiki_repository
unless
move_project_repository
log_error
(
'Repository cannot be moved'
)
return
false
end
# We try to move the wiki repo despite the fact the wiki enabled or not
# But we consider the move as failed, only if the wiki is enabled
# If the wiki is disabled but repository exists we need to move it anyway as it
# can be acquired by the different project if later someone will take the same name.
# Once we have hashed storage as the only option this problem will be eliminated
if
!
move_wiki_repository
&&
project
.
wiki_enabled?
log_error
(
'Wiki repository cannot be moved'
)
return
false
end
true
rescue
=>
ex
log_error
(
'Repository cannot be
renam
ed'
,
error:
ex
)
log_error
(
'Repository cannot be
mov
ed'
,
error:
ex
)
false
end
...
...
ee/changelogs/unreleased/geo-fix-wiki-moving.yml
0 → 100644
View file @
b805c2d7
---
title
:
"
[Geo]
Fix
project
rename
when
wiki
does
not
exist"
merge_request
:
author
:
type
:
fixed
ee/spec/services/geo/move_repository_service_spec.rb
View file @
b805c2d7
...
...
@@ -27,6 +27,8 @@ describe Geo::MoveRepositoryService, :geo do
.
with
(
project
.
repository_storage_path
,
old_path
,
new_path
)
.
and_return
(
false
)
expect
(
service
).
to
receive
(
:log_error
).
with
(
'Repository cannot be moved'
)
expect
(
service
.
execute
).
to
eq
false
end
...
...
@@ -39,7 +41,27 @@ describe Geo::MoveRepositoryService, :geo do
.
with
(
project
.
repository_storage_path
,
"
#{
old_path
}
.wiki"
,
"
#{
new_path
}
.wiki"
)
.
and_return
(
false
)
expect
(
service
).
to
receive
(
:log_error
).
with
(
'Wiki repository cannot be moved'
)
expect
(
service
.
execute
).
to
eq
false
end
context
'wiki disabled'
do
let
(
:project
)
{
create
(
:project
,
:repository
,
:wiki_disabled
,
:legacy_storage
)
}
it
'tries to move wiki even if it is not enabled without reporting error'
do
allow_any_instance_of
(
Gitlab
::
Shell
).
to
receive
(
:mv_repository
)
.
with
(
project
.
repository_storage_path
,
old_path
,
new_path
)
.
and_return
(
true
)
allow_any_instance_of
(
Gitlab
::
Shell
).
to
receive
(
:mv_repository
)
.
with
(
project
.
repository_storage_path
,
"
#{
old_path
}
.wiki"
,
"
#{
new_path
}
.wiki"
)
.
and_return
(
false
)
expect
(
service
).
not_to
receive
(
:log_error
)
expect
(
service
.
execute
).
to
eq
(
true
)
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