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
8a0a802e
Commit
8a0a802e
authored
Apr 05, 2016
by
Yorick Peterse
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix-gh-pr-import' into 'master'
Fix Importing repos from GHE doesn't work See merge request !3529
parents
6bf4e9e7
f2005fa5
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
0 deletions
+38
-0
app/models/repository.rb
app/models/repository.rb
+5
-0
app/services/projects/import_service.rb
app/services/projects/import_service.rb
+2
-0
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+14
-0
spec/services/projects/import_service_spec.rb
spec/services/projects/import_service_spec.rb
+17
-0
No files found.
app/models/repository.rb
View file @
8a0a802e
...
...
@@ -364,6 +364,11 @@ class Repository
expire_tag_count_cache
end
def
before_import
expire_emptiness_caches
expire_exists_cache
end
# Runs code after a repository has been forked/imported.
def
after_import
expire_emptiness_caches
...
...
app/services/projects/import_service.rb
View file @
8a0a802e
...
...
@@ -46,6 +46,8 @@ module Projects
def
import_data
return
unless
has_importer?
project
.
repository
.
before_import
unless
importer
.
execute
raise
Error
,
'The remote data could not be imported.'
end
...
...
spec/models/repository_spec.rb
View file @
8a0a802e
...
...
@@ -612,6 +612,20 @@ describe Repository, models: true do
end
end
describe
'#before_import'
do
it
'flushes the emptiness cachess'
do
expect
(
repository
).
to
receive
(
:expire_emptiness_caches
)
repository
.
before_import
end
it
'flushes the exists cache'
do
expect
(
repository
).
to
receive
(
:expire_exists_cache
)
repository
.
before_import
end
end
describe
'#after_import'
do
it
'flushes the emptiness cachess'
do
expect
(
repository
).
to
receive
(
:expire_emptiness_caches
)
...
...
spec/services/projects/import_service_spec.rb
View file @
8a0a802e
...
...
@@ -72,6 +72,23 @@ describe Projects::ImportService, services: true do
expect
(
result
[
:status
]).
to
eq
:success
end
it
'flushes various caches'
do
expect_any_instance_of
(
Gitlab
::
Shell
).
to
receive
(
:import_repository
).
with
(
project
.
path_with_namespace
,
project
.
import_url
).
and_return
(
true
)
expect_any_instance_of
(
Gitlab
::
GithubImport
::
Importer
).
to
receive
(
:execute
).
and_return
(
true
)
expect_any_instance_of
(
Repository
).
to
receive
(
:expire_emptiness_caches
).
and_call_original
expect_any_instance_of
(
Repository
).
to
receive
(
:expire_exists_cache
).
and_call_original
subject
.
execute
end
it
'fails if importer fails'
do
expect_any_instance_of
(
Gitlab
::
Shell
).
to
receive
(
:import_repository
).
with
(
project
.
path_with_namespace
,
project
.
import_url
).
and_return
(
true
)
expect_any_instance_of
(
Gitlab
::
GithubImport
::
Importer
).
to
receive
(
:execute
).
and_return
(
false
)
...
...
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