summaryrefslogtreecommitdiff
path: root/lib/github
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2017-07-17 21:17:22 -0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2017-08-07 13:06:13 -0300
commit8021a7244d3448ebc1631259c7d9d43503ccf29d (patch)
tree00e493aab4c95d400f6020a36f4984038e89062f /lib/github
parent517a9f97c7fefb350a2f8cfac84060e8b76e2818 (diff)
downloadgitlab-ce-8021a7244d3448ebc1631259c7d9d43503ccf29d.tar.gz
Expire content cache when repository fetch fails
Diffstat (limited to 'lib/github')
-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