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
d1c72fcc
Commit
d1c72fcc
authored
Oct 29, 2020
by
James Fargher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow project storage to be updated when no repositories exist
parent
a4b0fa69
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
7 deletions
+32
-7
app/services/projects/update_repository_storage_service.rb
app/services/projects/update_repository_storage_service.rb
+9
-7
changelogs/unreleased/allow_repo_storage_moves_without_repo.yml
...logs/unreleased/allow_repo_storage_moves_without_repo.yml
+5
-0
spec/services/projects/update_repository_storage_service_spec.rb
...rvices/projects/update_repository_storage_service_spec.rb
+18
-0
No files found.
app/services/projects/update_repository_storage_service.rb
View file @
d1c72fcc
...
...
@@ -54,7 +54,7 @@ module Projects
end
def
mirror_repositories
mirror_repository
mirror_repository
if
project
.
repository_exists?
if
project
.
wiki
.
repository_exists?
mirror_repository
(
type:
Gitlab
::
GlRepository
::
WIKI
)
...
...
@@ -92,12 +92,14 @@ module Projects
end
def
remove_old_paths
if
project
.
repository_exists?
Gitlab
::
Git
::
Repository
.
new
(
source_storage_name
,
"
#{
project
.
disk_path
}
.git"
,
nil
,
nil
).
remove
end
if
project
.
wiki
.
repository_exists?
Gitlab
::
Git
::
Repository
.
new
(
...
...
changelogs/unreleased/allow_repo_storage_moves_without_repo.yml
0 → 100644
View file @
d1c72fcc
---
title
:
Allow project storage to be updated when no repositories exist
merge_request
:
46385
author
:
type
:
fixed
spec/services/projects/update_repository_storage_service_spec.rb
View file @
d1c72fcc
...
...
@@ -168,6 +168,24 @@ RSpec.describe Projects::UpdateRepositoryStorageService do
end
end
context
'project with no repositories'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:repository_storage_move
)
{
create
(
:project_repository_storage_move
,
:scheduled
,
project:
project
,
destination_storage_name:
'test_second_storage'
)
}
it
'updates the database'
do
allow
(
Gitlab
::
GitalyClient
).
to
receive
(
:filesystem_id
).
with
(
'default'
).
and_call_original
allow
(
Gitlab
::
GitalyClient
).
to
receive
(
:filesystem_id
).
with
(
'test_second_storage'
).
and_return
(
SecureRandom
.
uuid
)
result
=
subject
.
execute
project
.
reload
expect
(
result
).
to
be_success
expect
(
project
).
not_to
be_repository_read_only
expect
(
project
.
repository_storage
).
to
eq
(
'test_second_storage'
)
expect
(
project
.
project_repository
.
shard_name
).
to
eq
(
'test_second_storage'
)
end
end
context
'with wiki repository'
do
include_examples
'moves repository to another storage'
,
'wiki'
do
let
(
:project
)
{
create
(
:project
,
:repository
,
wiki_enabled:
true
)
}
...
...
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