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
a23c648d
Commit
a23c648d
authored
Nov 06, 2019
by
John Cai
Committed by
Rémy Coutable
Nov 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only move repos for legacy project storage
parent
3dbb2de4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
3 deletions
+48
-3
app/models/concerns/storage/legacy_namespace.rb
app/models/concerns/storage/legacy_namespace.rb
+5
-3
changelogs/unreleased/jc-dont-try-to-movedirs-unless-legacy.yml
...logs/unreleased/jc-dont-try-to-movedirs-unless-legacy.yml
+5
-0
spec/models/namespace_spec.rb
spec/models/namespace_spec.rb
+38
-0
No files found.
app/models/concerns/storage/legacy_namespace.rb
View file @
a23c648d
...
...
@@ -55,7 +55,7 @@ module Storage
def
move_repositories
# Move the namespace directory in all storages used by member projects
repository_storages
.
each
do
|
repository_storage
|
repository_storages
(
legacy_only:
true
)
.
each
do
|
repository_storage
|
# Ensure old directory exists before moving it
gitlab_shell
.
add_namespace
(
repository_storage
,
full_path_before_last_save
)
...
...
@@ -77,12 +77,14 @@ module Storage
@old_repository_storage_paths
||=
repository_storages
end
def
repository_storages
def
repository_storages
(
legacy_only:
false
)
# We need to get the storage paths for all the projects, even the ones that are
# pending delete. Unscoping also get rids of the default order, which causes
# problems with SELECT DISTINCT.
Project
.
unscoped
do
all_projects
.
select
(
'distinct(repository_storage)'
).
to_a
.
map
(
&
:repository_storage
)
namespace_projects
=
all_projects
namespace_projects
=
namespace_projects
.
without_storage_feature
(
:repository
)
if
legacy_only
namespace_projects
.
pluck
(
Arel
.
sql
(
'distinct(repository_storage)'
))
end
end
...
...
changelogs/unreleased/jc-dont-try-to-movedirs-unless-legacy.yml
0 → 100644
View file @
a23c648d
---
title
:
Only move repos for legacy project storage
merge_request
:
19410
author
:
type
:
fixed
spec/models/namespace_spec.rb
View file @
a23c648d
...
...
@@ -281,6 +281,44 @@ describe Namespace do
end
end
shared_examples
'move_dir without repository storage feature'
do
|
storage_version
|
let
(
:namespace
)
{
create
(
:namespace
)
}
let
(
:gitlab_shell
)
{
namespace
.
gitlab_shell
}
let!
(
:project
)
{
create
(
:project_empty_repo
,
namespace:
namespace
,
storage_version:
storage_version
)
}
it
'calls namespace service'
do
expect
(
gitlab_shell
).
to
receive
(
:add_namespace
).
and_return
(
true
)
expect
(
gitlab_shell
).
to
receive
(
:mv_namespace
).
and_return
(
true
)
namespace
.
move_dir
end
end
shared_examples
'move_dir with repository storage feature'
do
|
storage_version
|
let
(
:namespace
)
{
create
(
:namespace
)
}
let
(
:gitlab_shell
)
{
namespace
.
gitlab_shell
}
let!
(
:project
)
{
create
(
:project_empty_repo
,
namespace:
namespace
,
storage_version:
storage_version
)
}
it
'does not call namespace service'
do
expect
(
gitlab_shell
).
not_to
receive
(
:add_namespace
)
expect
(
gitlab_shell
).
not_to
receive
(
:mv_namespace
)
namespace
.
move_dir
end
end
context
'project is without repository storage feature'
do
[
nil
,
0
].
each
do
|
storage_version
|
it_behaves_like
'move_dir without repository storage feature'
,
storage_version
end
end
context
'project has repository storage feature'
do
[
1
,
2
].
each
do
|
storage_version
|
it_behaves_like
'move_dir with repository storage feature'
,
storage_version
end
end
context
'with subgroups'
do
let
(
:parent
)
{
create
(
:group
,
name:
'parent'
,
path:
'parent'
)
}
let
(
:new_parent
)
{
create
(
:group
,
name:
'new_parent'
,
path:
'new_parent'
)
}
...
...
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