Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/git/repository.rb')
-rw-r--r--lib/gitlab/git/repository.rb24
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb
index 473bc04661c..5afdcc0bd4c 100644
--- a/lib/gitlab/git/repository.rb
+++ b/lib/gitlab/git/repository.rb
@@ -20,6 +20,7 @@ module Gitlab
EMPTY_REPOSITORY_CHECKSUM = '0000000000000000000000000000000000000000'
NoRepository = Class.new(::Gitlab::Git::BaseError)
+ RepositoryExists = Class.new(::Gitlab::Git::BaseError)
InvalidRepository = Class.new(::Gitlab::Git::BaseError)
InvalidBlobName = Class.new(::Gitlab::Git::BaseError)
InvalidRef = Class.new(::Gitlab::Git::BaseError)
@@ -101,6 +102,8 @@ module Gitlab
def create_repository
wrapped_gitaly_errors do
gitaly_repository_client.create_repository
+ rescue GRPC::AlreadyExists => e
+ raise RepositoryExists, e.message
end
end
@@ -198,9 +201,9 @@ module Gitlab
# Returns an Array of Tags
#
- def tags(sort_by: nil)
+ def tags(sort_by: nil, pagination_params: nil)
wrapped_gitaly_errors do
- gitaly_ref_client.tags(sort_by: sort_by)
+ gitaly_ref_client.tags(sort_by: sort_by, pagination_params: pagination_params)
end
end
@@ -519,6 +522,17 @@ module Gitlab
@refs_hash
end
+ # Returns matching refs for OID
+ #
+ # Limit of 0 means there is no limit.
+ def refs_by_oid(oid:, limit: 0)
+ wrapped_gitaly_errors do
+ gitaly_ref_client.find_refs_by_oid(oid: oid, limit: limit)
+ end
+ rescue CommandError, TypeError, NoRepository
+ nil
+ end
+
# Returns url for submodule
#
# Ex.
@@ -784,6 +798,12 @@ module Gitlab
end
end
+ def list_refs
+ wrapped_gitaly_errors do
+ gitaly_ref_client.list_refs
+ end
+ end
+
# Refactoring aid; allows us to copy code from app/models/repository.rb
def commit(ref = 'HEAD')
Gitlab::Git::Commit.find(self, ref)