summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-09-28 08:56:02 +0000
committerSean McGivern <sean@mcgivern.me.uk>2017-09-28 08:56:02 +0000
commite03bad12bf579a83a814c07399ef9bdc37e2f120 (patch)
tree915c7635a6aaa71f7ca5ffa862865ce3002a3d9e
parent355a1d8a6f3dc930911ab61646eb9b3d85d4d01e (diff)
parent412845f8de10d9072867a99b27c67950e54fa4c4 (diff)
downloadgitlab-ce-e03bad12bf579a83a814c07399ef9bdc37e2f120.tar.gz
Merge branch 'zj-repo-gitaly' into 'master'
RepositoryExists is always called with #gitaly_migration Closes #38333 See merge request gitlab-org/gitlab-ce!14513
-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