summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <git@zjvandeweg.nl>2018-06-14 10:13:15 +0200
committerZeger-Jan van de Weg <git@zjvandeweg.nl>2018-06-14 10:13:15 +0200
commit36d75be393eaa8385a4ba121b11b9d8e02ad52de (patch)
tree67bb97bceb79e78458a943355219e23804964e27
parent89095530bc750a780f1f03bc3c6a31c5491418db (diff)
downloadgitlab-ce-36d75be393eaa8385a4ba121b11b9d8e02ad52de.tar.gz
Move TagNames to mandatory through Gitaly
Closes: https://gitlab.com/gitlab-org/gitaly/issues/220
-rw-r--r--lib/gitlab/git/repository.rb22
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb
index 6e149984a49..37c0af3622e 100644
--- a/lib/gitlab/git/repository.rb
+++ b/lib/gitlab/git/repository.rb
@@ -150,12 +150,8 @@ module Gitlab
# Returns an Array of branch names
# sorted by name ASC
def branch_names
- gitaly_migrate(:branch_names, status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) do |is_enabled|
- if is_enabled
- gitaly_ref_client.branch_names
- else
- branches.map(&:name)
- end
+ wrapped_gitaly_errors do
+ gitaly_ref_client.branch_names
end
end
@@ -268,7 +264,9 @@ module Gitlab
# Returns an Array of tag names
def tag_names
- gitaly_ref_client.tag_names
+ wrapped_gitaly_errors do
+ gitaly_ref_client.tag_names
+ end
end
# Returns an Array of Tags
@@ -1420,6 +1418,16 @@ module Gitlab
raise CommandError.new(e)
end
+ def wrapped_gitaly_errors(&block)
+ yield block
+ rescue GRPC::NotFound => e
+ raise NoRepository.new(e)
+ rescue GRPC::InvalidArgument => e
+ raise ArgumentError.new(e)
+ rescue GRPC::BadStatus => e
+ raise CommandError.new(e)
+ end
+
def clean_stale_repository_files
gitaly_migrate(:repository_cleanup, status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) do |is_enabled|
gitaly_repository_client.cleanup if is_enabled && exists?