summaryrefslogtreecommitdiff
path: root/lib/gitlab
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <git@zjvandeweg.nl>2017-09-26 20:07:27 +0200
committerAlejandro Rodríguez <alejorro70@gmail.com>2017-09-26 19:40:49 -0300
commita02881dfda8cc65cfa5f9eeeee5f2c24496cbb69 (patch)
treee2b2e9be5ea1f243b7b889a1838dca5435853682 /lib/gitlab
parentcae3417381222c527077be5330ef1b2222d31103 (diff)
downloadgitlab-ce-a02881dfda8cc65cfa5f9eeeee5f2c24496cbb69.tar.gz
RepositoryExists is always called with #gitaly_migration
Diffstat (limited to 'lib/gitlab')
-rw-r--r--lib/gitlab/git/repository.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb
index 616b075c087..8c1df650567 100644
--- a/lib/gitlab/git/repository.rb
+++ b/lib/gitlab/git/repository.rb
@@ -73,8 +73,6 @@ module Gitlab
delegate :empty?,
to: :rugged
- delegate :exists?, to: :gitaly_repository_client
-
def ==(other)
path == other.path
end
@@ -102,6 +100,18 @@ module Gitlab
@circuit_breaker ||= Gitlab::Git::Storage::CircuitBreaker.for_storage(storage)
end
+ def exists?
+ Gitlab::GitalyClient.migrate(:repository_exists) do |enabled|
+ if enabled
+ gitaly_repository_client.exists?
+ else
+ circuit_breaker.perform do
+ File.exist?(File.join(@path, 'refs'))
+ end
+ end
+ end
+ end
+
# Returns an Array of branch names
# sorted by name ASC
def branch_names