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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
02276f7a
Commit
02276f7a
authored
Dec 22, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix import scheduled on bare repo import
parent
ac35636f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
1 deletion
+12
-1
app/services/projects/create_service.rb
app/services/projects/create_service.rb
+2
-1
lib/gitlab/bare_repository_import/importer.rb
lib/gitlab/bare_repository_import/importer.rb
+2
-0
spec/lib/gitlab/bare_repository_import/importer_spec.rb
spec/lib/gitlab/bare_repository_import/importer_spec.rb
+8
-0
No files found.
app/services/projects/create_service.rb
View file @
02276f7a
...
@@ -12,6 +12,7 @@ module Projects
...
@@ -12,6 +12,7 @@ module Projects
forked_from_project_id
=
params
.
delete
(
:forked_from_project_id
)
forked_from_project_id
=
params
.
delete
(
:forked_from_project_id
)
import_data
=
params
.
delete
(
:import_data
)
import_data
=
params
.
delete
(
:import_data
)
@skip_wiki
=
params
.
delete
(
:skip_wiki
)
@skip_wiki
=
params
.
delete
(
:skip_wiki
)
@skip_import
=
params
.
delete
(
:skip_import
)
@project
=
Project
.
new
(
params
)
@project
=
Project
.
new
(
params
)
...
@@ -57,7 +58,7 @@ module Projects
...
@@ -57,7 +58,7 @@ module Projects
after_create_actions
if
@project
.
persisted?
after_create_actions
if
@project
.
persisted?
if
@project
.
errors
.
empty?
if
@project
.
errors
.
empty?
@project
.
import_schedule
if
@project
.
import?
@project
.
import_schedule
if
@project
.
import?
&&
!
@skip_import
else
else
fail
(
error:
@project
.
errors
.
full_messages
.
join
(
', '
))
fail
(
error:
@project
.
errors
.
full_messages
.
join
(
', '
))
end
end
...
...
lib/gitlab/bare_repository_import/importer.rb
View file @
02276f7a
...
@@ -55,6 +55,8 @@ module Gitlab
...
@@ -55,6 +55,8 @@ module Gitlab
name:
project_name
,
name:
project_name
,
path:
project_name
,
path:
project_name
,
skip_disk_validation:
true
,
skip_disk_validation:
true
,
skip_wiki:
bare_repo
.
wiki_exists?
,
skip_import:
true
,
import_type:
'gitlab_project'
,
import_type:
'gitlab_project'
,
namespace_id:
group
&
.
id
).
execute
namespace_id:
group
&
.
id
).
execute
...
...
spec/lib/gitlab/bare_repository_import/importer_spec.rb
View file @
02276f7a
...
@@ -68,6 +68,12 @@ describe Gitlab::BareRepositoryImport::Importer, repository: true do
...
@@ -68,6 +68,12 @@ describe Gitlab::BareRepositoryImport::Importer, repository: true do
expect
(
Project
.
find_by_full_path
(
project_path
)).
not_to
be_nil
expect
(
Project
.
find_by_full_path
(
project_path
)).
not_to
be_nil
end
end
it
'does not schedule an import'
do
expect_any_instance_of
(
Project
).
not_to
receive
(
:import_schedule
)
importer
.
create_project_if_needed
end
it
'creates the Git repo in disk'
do
it
'creates the Git repo in disk'
do
FileUtils
.
mkdir_p
(
File
.
join
(
base_dir
,
"
#{
project_path
}
.git"
))
FileUtils
.
mkdir_p
(
File
.
join
(
base_dir
,
"
#{
project_path
}
.git"
))
...
@@ -161,6 +167,8 @@ describe Gitlab::BareRepositoryImport::Importer, repository: true do
...
@@ -161,6 +167,8 @@ describe Gitlab::BareRepositoryImport::Importer, repository: true do
FileUtils
.
mkdir_p
(
File
.
join
(
base_dir
,
"
#{
project_path
}
.git"
))
FileUtils
.
mkdir_p
(
File
.
join
(
base_dir
,
"
#{
project_path
}
.git"
))
FileUtils
.
mkdir_p
(
File
.
join
(
base_dir
,
"
#{
project_path
}
.wiki.git"
))
FileUtils
.
mkdir_p
(
File
.
join
(
base_dir
,
"
#{
project_path
}
.wiki.git"
))
expect
(
Projects
::
CreateService
).
to
receive
(
:new
).
with
(
admin
,
hash_including
(
skip_import:
true
)).
and_call_original
importer
.
create_project_if_needed
importer
.
create_project_if_needed
project
=
Project
.
find_by_full_path
(
project_path
)
project
=
Project
.
find_by_full_path
(
project_path
)
...
...
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