summaryrefslogtreecommitdiff
path: root/lib/gitlab/git/repository.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-10-20 09:40:42 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-10-20 09:40:42 +0000
commitee664acb356f8123f4f6b00b73c1e1cf0866c7fb (patch)
treef8479f94a28f66654c6a4f6fb99bad6b4e86a40e /lib/gitlab/git/repository.rb
parent62f7d5c5b69180e82ae8196b7b429eeffc8e7b4f (diff)
downloadgitlab-ce-ee664acb356f8123f4f6b00b73c1e1cf0866c7fb.tar.gz
Add latest changes from gitlab-org/gitlab@15-5-stable-eev15.5.0-rc42
Diffstat (limited to 'lib/gitlab/git/repository.rb')
-rw-r--r--lib/gitlab/git/repository.rb29
1 files changed, 25 insertions, 4 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb
index f1cd75258be..9bbe17dcad1 100644
--- a/lib/gitlab/git/repository.rb
+++ b/lib/gitlab/git/repository.rb
@@ -783,10 +783,31 @@ module Gitlab
end
end
- def license_short_name
+ def license(from_gitaly)
wrapped_gitaly_errors do
- gitaly_repository_client.license_short_name
+ response = gitaly_repository_client.find_license
+
+ break nil if response.license_short_name.empty?
+
+ if from_gitaly
+ break ::Gitlab::Git::DeclaredLicense.new(key: response.license_short_name,
+ name: response.license_name,
+ nickname: response.license_nickname.presence,
+ url: response.license_url.presence,
+ path: response.license_path)
+ end
+
+ licensee_object = Licensee::License.new(response.license_short_name)
+
+ break nil if licensee_object.name.blank?
+
+ licensee_object.meta.nickname = "LICENSE" if licensee_object.key == "other"
+
+ licensee_object
end
+ rescue Licensee::InvalidLicense => e
+ Gitlab::ErrorTracking.track_exception(e)
+ nil
end
def fetch_source_branch!(source_repository, source_branch, local_ref)
@@ -1008,8 +1029,8 @@ module Gitlab
@praefect_info_client ||= Gitlab::GitalyClient::PraefectInfoService.new(self)
end
- def branch_names_contains_sha(sha)
- gitaly_ref_client.branch_names_contains_sha(sha)
+ def branch_names_contains_sha(sha, limit: 0)
+ gitaly_ref_client.branch_names_contains_sha(sha, limit: limit)
end
def tag_names_contains_sha(sha, limit: 0)