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
b0734bdb
Commit
b0734bdb
authored
Feb 08, 2021
by
Francisco Javier López
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug importing wikis and multiple shards
parent
4214e1c1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
1 deletion
+34
-1
ee/lib/ee/gitlab/import_export/repo_restorer.rb
ee/lib/ee/gitlab/import_export/repo_restorer.rb
+23
-0
ee/spec/lib/ee/gitlab/import_export/repo_restorer_spec.rb
ee/spec/lib/ee/gitlab/import_export/repo_restorer_spec.rb
+2
-1
lib/gitlab/import_export/repo_restorer.rb
lib/gitlab/import_export/repo_restorer.rb
+9
-0
No files found.
ee/lib/ee/gitlab/import_export/repo_restorer.rb
0 → 100644
View file @
b0734bdb
# frozen_string_literal: true
module
EE
module
Gitlab
module
ImportExport
module
RepoRestorer
extend
::
Gitlab
::
Utils
::
Override
private
override
:update_importable_repository_info
def
update_importable_repository_info
return
super
unless
importable
.
is_a?
(
GroupWiki
)
# At this point, the repo has been created but we
# need to track the repository shard instantiated
# inside the repository object.
importable
.
track_wiki_repository
(
repository
.
shard
)
end
end
end
end
end
ee/spec/lib/ee/gitlab/import_export/repo_restorer_spec.rb
View file @
b0734bdb
...
...
@@ -44,7 +44,7 @@ RSpec.describe Gitlab::ImportExport::RepoRestorer do
it
'restores the repo successfully'
,
:aggregated_failures
do
expect
(
group
.
wiki_repository_exists?
).
to
be
false
restorer
.
restore
expect
{
restorer
.
restore
}.
to
change
{
GroupWikiRepository
.
count
}.
by
(
1
)
pages
=
group
.
wiki
.
list_pages
(
load_content:
true
)
expect
(
pages
.
size
).
to
eq
1
...
...
@@ -59,6 +59,7 @@ RSpec.describe Gitlab::ImportExport::RepoRestorer do
it
'does not creates an empty wiki'
do
expect
(
restorer
.
restore
).
to
be
true
expect
(
group
.
wiki_repository_exists?
).
to
be
false
expect
(
group
.
group_wiki_repository
).
to
be_nil
end
end
end
...
...
lib/gitlab/import_export/repo_restorer.rb
View file @
b0734bdb
...
...
@@ -19,6 +19,9 @@ module Gitlab
ensure_repository_does_not_exist!
repository
.
create_from_bundle
(
path_to_bundle
)
update_importable_repository_info
true
rescue
=>
e
shared
.
error
(
e
)
false
...
...
@@ -32,6 +35,10 @@ module Gitlab
attr_accessor
:path_to_bundle
,
:shared
def
update_importable_repository_info
# No-op. Overridden in EE
end
def
ensure_repository_does_not_exist!
if
repository
.
exists?
shared
.
logger
.
info
(
...
...
@@ -44,3 +51,5 @@ module Gitlab
end
end
end
Gitlab
::
ImportExport
::
RepoRestorer
.
prepend_if_ee
(
'EE::Gitlab::ImportExport::RepoRestorer'
)
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