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
cc9fbfcc
Commit
cc9fbfcc
authored
Jun 01, 2020
by
Francisco Javier López
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change snippet import logic from db
parent
461d574c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
12 deletions
+9
-12
changelogs/unreleased/fj-fix-snippet-import-from-database.yml
...gelogs/unreleased/fj-fix-snippet-import-from-database.yml
+5
-0
lib/gitlab/import_export/snippet_repo_restorer.rb
lib/gitlab/import_export/snippet_repo_restorer.rb
+1
-8
spec/lib/gitlab/import_export/snippet_repo_restorer_spec.rb
spec/lib/gitlab/import_export/snippet_repo_restorer_spec.rb
+3
-4
No files found.
changelogs/unreleased/fj-fix-snippet-import-from-database.yml
0 → 100644
View file @
cc9fbfcc
---
title
:
Fix snippet repository import edge cases
merge_request
:
33506
author
:
type
:
fixed
lib/gitlab/import_export/snippet_repo_restorer.rb
View file @
cc9fbfcc
...
...
@@ -34,14 +34,7 @@ module Gitlab
end
def
create_repository_from_db
snippet
.
create_repository
commit_attrs
=
{
branch_name:
'master'
,
message:
'Initial commit'
}
repository
.
create_file
(
@user
,
snippet
.
file_name
,
snippet
.
content
,
commit_attrs
)
Gitlab
::
BackgroundMigration
::
BackfillSnippetRepositories
.
new
.
perform_by_ids
([
snippet
.
id
])
end
end
end
...
...
spec/lib/gitlab/import_export/snippet_repo_restorer_spec.rb
View file @
cc9fbfcc
...
...
@@ -25,10 +25,9 @@ describe Gitlab::ImportExport::SnippetRepoRestorer do
expect
(
snippet
.
repository_exists?
).
to
be_falsey
aggregate_failures
do
expect
(
restorer
.
restore
).
to
be_truthy
expect
(
snippet
.
repository_exists?
).
to
be_truthy
expect
(
snippet
.
snippet_repository
).
not_to
be_nil
expect
do
expect
(
restorer
.
restore
).
to
be_truthy
end
.
to
change
{
SnippetRepository
.
count
}.
by
(
1
)
blob
=
snippet
.
repository
.
blob_at
(
'HEAD'
,
snippet
.
file_name
)
expect
(
blob
).
not_to
be_nil
...
...
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