Update upstream source from tag 'upstream/13.12.4+ds1'

Update to upstream version '13.12.4+ds1'
with Debian dir b4799be9cb
This commit is contained in:
Pirate Praveen 2021-06-21 23:57:32 +05:30
commit e3bd3d3d08
10 changed files with 140 additions and 6 deletions

View file

@ -2,6 +2,14 @@
documentation](doc/development/changelog.md) for instructions on adding your own documentation](doc/development/changelog.md) for instructions on adding your own
entry. entry.
## 13.12.4 (2021-06-14)
### Fixed (3 changes)
- [Add alias method usage_ping_enabled?](gitlab-org/gitlab@eb8755115a2a7045b6291171aaa0c7ae76f43fec) ([merge request](gitlab-org/gitlab!63974))
- [Fix MR diff compare with previous version](gitlab-org/gitlab@96d4df8bb4eb5f148e4dabcc4c3eea88ad27cbc3) ([merge request](gitlab-org/gitlab!63974))
- [Fix double render in project's git URL redirect](gitlab-org/gitlab@be4059b7a5cddd2e70fa760d8935b1d170068759) ([merge request](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/62053))
## 13.12.3 (2021-06-07) ## 13.12.3 (2021-06-07)
### Added (1 change) ### Added (1 change)

View file

@ -1 +1 @@
13.12.3 13.12.4

View file

@ -1 +1 @@
13.12.3 13.12.4

View file

@ -163,7 +163,10 @@ class Projects::MergeRequests::DiffsController < Projects::MergeRequests::Applic
end end
def render_merge_ref_head_diff? def render_merge_ref_head_diff?
Gitlab::Utils.to_boolean(params[:diff_head]) && @merge_request.diffable_merge_ref? && @start_sha.nil? params[:diff_id].blank? &&
Gitlab::Utils.to_boolean(params[:diff_head]) &&
@merge_request.diffable_merge_ref? &&
@start_sha.nil?
end end
def note_positions def note_positions

View file

@ -510,7 +510,7 @@ class ProjectsController < Projects::ApplicationController
# `project` calls `find_routable!`, so this will trigger the usual not-found # `project` calls `find_routable!`, so this will trigger the usual not-found
# behaviour when the user isn't authorized to see the project # behaviour when the user isn't authorized to see the project
return unless project return if project.nil? || performed?
redirect_to(request.original_url.sub(%r{\.git/?\Z}, '')) redirect_to(request.original_url.sub(%r{\.git/?\Z}, ''))
end end

View file

@ -374,6 +374,7 @@ module ApplicationSettingImplementation
def usage_ping_enabled def usage_ping_enabled
usage_ping_can_be_configured? && super usage_ping_can_be_configured? && super
end end
alias_method :usage_ping_enabled?, :usage_ping_enabled
def allowed_key_types def allowed_key_types
SUPPORTED_KEY_TYPES.select do |type| SUPPORTED_KEY_TYPES.select do |type|

View file

@ -69,6 +69,20 @@ RSpec.describe Projects::MergeRequests::DiffsController do
end end
end end
shared_examples 'show the right diff files with previous diff_id' do
context 'with previous diff_id' do
let!(:merge_request_diff_1) { merge_request.merge_request_diffs.create!(head_commit_sha: '6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9') }
let!(:merge_request_diff_2) { merge_request.merge_request_diffs.create!(head_commit_sha: '5937ac0a7beb003549fc5fd26fc247adbce4a52e', diff_type: :merge_head) }
subject { go(diff_id: merge_request_diff_1.id, diff_head: true) }
it 'shows the right diff files' do
subject
expect(json_response["diff_files"].size).to eq(merge_request_diff_1.files_count)
end
end
end
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) } let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) }
@ -142,6 +156,8 @@ RSpec.describe Projects::MergeRequests::DiffsController do
it_behaves_like '404 for unexistent diffable' it_behaves_like '404 for unexistent diffable'
it_behaves_like 'show the right diff files with previous diff_id'
context 'when not authorized' do context 'when not authorized' do
let(:another_user) { create(:user) } let(:another_user) { create(:user) }
@ -480,6 +496,8 @@ RSpec.describe Projects::MergeRequests::DiffsController do
it_behaves_like '404 for unexistent diffable' it_behaves_like '404 for unexistent diffable'
it_behaves_like 'show the right diff files with previous diff_id'
context 'when not authorized' do context 'when not authorized' do
let(:other_user) { create(:user) } let(:other_user) { create(:user) }
@ -499,7 +517,7 @@ RSpec.describe Projects::MergeRequests::DiffsController do
it_behaves_like 'serializes diffs with expected arguments' do it_behaves_like 'serializes diffs with expected arguments' do
let(:collection) { Gitlab::Diff::FileCollection::MergeRequestDiffBatch } let(:collection) { Gitlab::Diff::FileCollection::MergeRequestDiffBatch }
let(:expected_options) { collection_arguments(current_page: 1, total_pages: 1) } let(:expected_options) { collection_arguments(current_page: 1, total_pages: 1).merge(merge_ref_head_diff: false) }
end end
it_behaves_like 'successful request' it_behaves_like 'successful request'
@ -522,7 +540,7 @@ RSpec.describe Projects::MergeRequests::DiffsController do
it_behaves_like 'serializes diffs with expected arguments' do it_behaves_like 'serializes diffs with expected arguments' do
let(:collection) { Gitlab::Diff::FileCollection::Compare } let(:collection) { Gitlab::Diff::FileCollection::Compare }
let(:expected_options) { collection_arguments } let(:expected_options) { collection_arguments.merge(merge_ref_head_diff: false) }
end end
it_behaves_like 'successful request' it_behaves_like 'successful request'

View file

@ -375,6 +375,23 @@ RSpec.describe ProjectsController do
end end
end end
context 'when project is moved and git format is requested' do
let(:old_path) { project.path + 'old' }
before do
project.redirect_routes.create!(path: "#{project.namespace.full_path}/#{old_path}")
project.add_developer(user)
sign_in(user)
end
it 'redirects to new project path' do
get :show, params: { namespace_id: project.namespace, id: old_path }, format: :git
expect(response).to redirect_to(project_path(project, format: :git))
end
end
context 'when the project is forked and has a repository', :request_store do context 'when the project is forked and has a repository', :request_store do
let(:public_project) { create(:project, :public, :repository) } let(:public_project) { create(:project, :public, :repository) }
let(:other_user) { create(:user) } let(:other_user) { create(:user) }

View file

@ -363,6 +363,85 @@ RSpec.describe ApplicationSetting do
.is_less_than(65536) .is_less_than(65536)
end end
describe 'usage_ping_enabled setting' do
shared_examples 'usage ping enabled' do
it do
expect(setting.usage_ping_enabled).to eq(true)
expect(setting.usage_ping_enabled?).to eq(true)
end
end
shared_examples 'usage ping disabled' do
it do
expect(setting.usage_ping_enabled).to eq(false)
expect(setting.usage_ping_enabled?).to eq(false)
end
end
context 'when setting is in database' do
context 'with usage_ping_enabled disabled' do
before do
setting.update!(usage_ping_enabled: false)
end
it_behaves_like 'usage ping disabled'
end
context 'with usage_ping_enabled enabled' do
before do
setting.update!(usage_ping_enabled: true)
end
it_behaves_like 'usage ping enabled'
end
end
context 'when setting is in GitLab config' do
context 'with usage_ping_enabled disabled' do
before do
allow(Settings.gitlab).to receive(:usage_ping_enabled).and_return(false)
end
it_behaves_like 'usage ping disabled'
end
context 'with usage_ping_enabled enabled' do
before do
allow(Settings.gitlab).to receive(:usage_ping_enabled).and_return(true)
end
it_behaves_like 'usage ping enabled'
end
end
context 'when setting in database false and setting in GitLab config true' do
before do
setting.update!(usage_ping_enabled: false)
allow(Settings.gitlab).to receive(:usage_ping_enabled).and_return(true)
end
it_behaves_like 'usage ping disabled'
end
context 'when setting database true and setting in GitLab config false' do
before do
setting.update!(usage_ping_enabled: true)
allow(Settings.gitlab).to receive(:usage_ping_enabled).and_return(false)
end
it_behaves_like 'usage ping disabled'
end
context 'when setting database true and setting in GitLab config true' do
before do
setting.update!(usage_ping_enabled: true)
allow(Settings.gitlab).to receive(:usage_ping_enabled).and_return(true)
end
it_behaves_like 'usage ping enabled'
end
end
context 'key restrictions' do context 'key restrictions' do
it 'supports all key types' do it 'supports all key types' do
expect(described_class::SUPPORTED_KEY_TYPES).to contain_exactly(:rsa, :dsa, :ecdsa, :ed25519) expect(described_class::SUPPORTED_KEY_TYPES).to contain_exactly(:rsa, :dsa, :ecdsa, :ed25519)

View file

@ -90,6 +90,14 @@ RSpec.describe SubmitUsagePingService do
it_behaves_like 'does not run' it_behaves_like 'does not run'
end end
context 'when usage ping is disabled from GitLab config file' do
before do
stub_config_setting(usage_ping_enabled: false)
end
it_behaves_like 'does not run'
end
context 'when usage ping is enabled' do context 'when usage ping is enabled' do
before do before do
stub_usage_data_connections stub_usage_data_connections