Remove feature gate for ListNewCommits

Introduced by https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/20087,
this has been tested on .com now, and is stable.

Closes https://gitlab.com/gitlab-org/gitaly/issues/1286
Closes https://gitlab.com/gitlab-org/gitaly/issues/1233
This commit is contained in:
Zeger-Jan van de Weg 2018-08-14 10:34:15 +02:00
parent 00c474ae4e
commit 5ddc9ad0b9
No known key found for this signature in database
GPG key ID: 65F6A8D64A88ABAC
2 changed files with 19 additions and 38 deletions

View file

@ -366,18 +366,9 @@ module Gitlab
end
end
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/1233
def new_commits(newrev)
gitaly_migrate(:new_commits) do |is_enabled|
if is_enabled
gitaly_ref_client.list_new_commits(newrev)
else
refs = Gitlab::GitalyClient::StorageSettings.allow_disk_access do
rev_list(including: newrev, excluding: :all).split("\n").map(&:strip)
end
Gitlab::Git::Commit.batch_by_oid(self, refs)
end
wrapped_gitaly_errors do
gitaly_ref_client.list_new_commits(newrev)
end
end

View file

@ -296,40 +296,30 @@ describe Repository do
end
describe '#new_commits' do
shared_examples 'finding unreferenced commits' do
set(:project) { create(:project, :repository) }
let(:repository) { project.repository }
set(:project) { create(:project, :repository) }
let(:repository) { project.repository }
subject { repository.new_commits(rev) }
subject { repository.new_commits(rev) }
context 'when there are no new commits' do
let(:rev) { repository.commit.id }
context 'when there are no new commits' do
let(:rev) { repository.commit.id }
it 'returns an empty array' do
expect(subject).to eq([])
end
end
context 'when new commits are found' do
let(:branch) { 'orphaned-branch' }
let!(:rev) { repository.commit(branch).id }
it 'returns the commits' do
repository.delete_branch(branch)
expect(subject).not_to be_empty
expect(subject).to all( be_a(::Commit) )
expect(subject.size).to eq(1)
end
it 'returns an empty array' do
expect(subject).to eq([])
end
end
context 'when Gitaly handles the request' do
it_behaves_like 'finding unreferenced commits'
end
context 'when new commits are found' do
let(:branch) { 'orphaned-branch' }
let!(:rev) { repository.commit(branch).id }
context 'when Gitaly is disabled', :disable_gitaly do
it_behaves_like 'finding unreferenced commits'
it 'returns the commits' do
repository.delete_branch(branch)
expect(subject).not_to be_empty
expect(subject).to all( be_a(::Commit) )
expect(subject.size).to eq(1)
end
end
end