diff options
author | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2017-09-26 20:07:27 +0200 |
---|---|---|
committer | Alejandro RodrÃguez <alejorro70@gmail.com> | 2017-09-26 19:40:49 -0300 |
commit | a02881dfda8cc65cfa5f9eeeee5f2c24496cbb69 (patch) | |
tree | e2b2e9be5ea1f243b7b889a1838dca5435853682 /lib | |
parent | cae3417381222c527077be5330ef1b2222d31103 (diff) | |
download | gitlab-ce-a02881dfda8cc65cfa5f9eeeee5f2c24496cbb69.tar.gz |
RepositoryExists is always called with #gitaly_migration
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/git/repository.rb | 14 |
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 |