summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/github/import.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/github/import.rb b/lib/github/import.rb
index fa2c6790ba7..fa279a85433 100644
--- a/lib/github/import.rb
+++ b/lib/github/import.rb
@@ -75,6 +75,7 @@ module Github
true
rescue Github::RepositoryFetchError
+ expire_repository_cache
false
ensure
keep_track_of_errors
@@ -88,7 +89,7 @@ module Github
project.repository.add_remote('github', repo_url)
project.repository.set_remote_as_mirror('github')
project.repository.fetch_remote('github', forced: true)
- rescue Gitlab::Shell::Error => e
+ rescue Gitlab::Git::Repository::NoRepository, Gitlab::Shell::Error => e
error(:project, repo_url, e.message)
raise Github::RepositoryFetchError
end
@@ -368,7 +369,7 @@ module Github
end
def expire_repository_cache
- repository.expire_content_cache
+ repository.expire_content_cache if project.repository_exists?
end
def keep_track_of_errors