summaryrefslogtreecommitdiff
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
parentcae3417381222c527077be5330ef1b2222d31103 (diff)
downloadgitlab-ce-a02881dfda8cc65cfa5f9eeeee5f2c24496cbb69.tar.gz
RepositoryExists is always called with #gitaly_migration
-rw-r--r--app/models/repository.rb18
-rw-r--r--changelogs/unreleased/zj-repo-gitaly.yml5
-rw-r--r--lib/gitlab/git/repository.rb14
3 files changed, 18 insertions, 19 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index b28fe79e19c..f0de2697dfc 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -489,13 +489,7 @@ class Repository
def exists?
return false unless full_path
- Gitlab::GitalyClient.migrate(:repository_exists) do |enabled|
- if enabled
- raw_repository.exists?
- else
- refs_directory_exists?
- end
- end
+ raw_repository.exists?
end
cache_method :exists?
@@ -1063,12 +1057,6 @@ class Repository
blob.data
end
- def refs_directory_exists?
- circuit_breaker.perform do
- File.exist?(File.join(path_to_repo, 'refs'))
- end
- end
-
def cache
# TODO: should we use UUIDs here? We could move repositories without clearing this cache
@cache ||= RepositoryCache.new(full_path, @project.id)
@@ -1120,10 +1108,6 @@ class Repository
Gitlab::Git::Repository.new(project.repository_storage, disk_path + '.git', Gitlab::GlRepository.gl_repository(project, false))
end
- def circuit_breaker
- @circuit_breaker ||= Gitlab::Git::Storage::CircuitBreaker.for_storage(project.repository_storage)
- end
-
def find_commits_by_message_by_shelling_out(query, ref, path, limit, offset)
ref ||= root_ref
diff --git a/changelogs/unreleased/zj-repo-gitaly.yml b/changelogs/unreleased/zj-repo-gitaly.yml
new file mode 100644
index 00000000000..634f6ba1b8b
--- /dev/null
+++ b/changelogs/unreleased/zj-repo-gitaly.yml
@@ -0,0 +1,5 @@
+---
+title: Gitaly RepositoryExists remains opt-in for all method calls
+merge_request:
+author:
+type: fixed
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