diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-09-28 11:56:02 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-09-28 11:56:02 +0300 |
commit | e03bad12bf579a83a814c07399ef9bdc37e2f120 (patch) | |
tree | 915c7635a6aaa71f7ca5ffa862865ce3002a3d9e /lib/gitlab | |
parent | 355a1d8a6f3dc930911ab61646eb9b3d85d4d01e (diff) | |
parent | 412845f8de10d9072867a99b27c67950e54fa4c4 (diff) |
Merge branch 'zj-repo-gitaly' into 'master'
RepositoryExists is always called with #gitaly_migration
Closes #38333
See merge request gitlab-org/gitlab-ce!14513
Diffstat (limited to 'lib/gitlab')
-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 |