summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2018-06-19 09:55:13 +0000
committerDouwe Maan <douwe@gitlab.com>2018-06-19 09:55:13 +0000
commit7a42d86581ec4515466f0e97c1e6b3d0feb53259 (patch)
tree26128a9ec223de44f00ed4d235f13b913f0e3b79
parent05474b3505c954dcb3b3716ade80eba411e81f94 (diff)
parentda8419a1ba1cbcc6c5c6365c99419cf17ab2d497 (diff)
downloadgitlab-ce-7a42d86581ec4515466f0e97c1e6b3d0feb53259.tar.gz
Merge branch 'zj-gitaly-license-detection' into 'master'
License detection happens solely through Gitaly now Closes gitaly#1026 See merge request gitlab-org/gitlab-ce!19986
-rw-r--r--lib/gitlab/git/repository.rb14
-rw-r--r--spec/lib/gitlab/git/repository_spec.rb28
2 files changed, 11 insertions, 31 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb
index eb5d6318dcb..b028753bb2e 100644
--- a/lib/gitlab/git/repository.rb
+++ b/lib/gitlab/git/repository.rb
@@ -1054,18 +1054,8 @@ module Gitlab
end
def license_short_name
- gitaly_migrate(:license_short_name,
- status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) do |is_enabled|
- if is_enabled
- gitaly_repository_client.license_short_name
- else
- begin
- # The licensee gem creates a Rugged object from the path:
- # https://github.com/benbalter/licensee/blob/v8.7.0/lib/licensee/projects/git_project.rb
- Licensee.license(path).try(:key)
- rescue Rugged::Error
- end
- end
+ wrapped_gitaly_errors do
+ gitaly_repository_client.license_short_name
end
end
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb
index 5bae99101e6..f0e7e390f8b 100644
--- a/spec/lib/gitlab/git/repository_spec.rb
+++ b/spec/lib/gitlab/git/repository_spec.rb
@@ -1727,31 +1727,21 @@ describe Gitlab::Git::Repository, seed_helper: true do
end
describe '#license_short_name' do
- shared_examples 'acquiring the Licensee license key' do
- subject { repository.license_short_name }
+ subject { repository.license_short_name }
- context 'when no license file can be found' do
- let(:project) { create(:project, :repository) }
- let(:repository) { project.repository.raw_repository }
-
- before do
- project.repository.delete_file(project.owner, 'LICENSE', message: 'remove license', branch_name: 'master')
- end
-
- it { is_expected.to be_nil }
- end
+ context 'when no license file can be found' do
+ let(:project) { create(:project, :repository) }
+ let(:repository) { project.repository.raw_repository }
- context 'when an mit license is found' do
- it { is_expected.to eq('mit') }
+ before do
+ project.repository.delete_file(project.owner, 'LICENSE', message: 'remove license', branch_name: 'master')
end
- end
- context 'when gitaly is enabled' do
- it_behaves_like 'acquiring the Licensee license key'
+ it { is_expected.to be_nil }
end
- context 'when gitaly is disabled', :disable_gitaly do
- it_behaves_like 'acquiring the Licensee license key'
+ context 'when an mit license is found' do
+ it { is_expected.to eq('mit') }
end
end