Commit bbbcb914 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'zj-remove-feature-gate-list-commits' into 'master'

Remove feature gate for ListNewCommits

Closes gitaly#1286 and gitaly#1233

See merge request gitlab-org/gitlab-ce!21184
parents d9614e70 5ddc9ad0
...@@ -366,18 +366,9 @@ module Gitlab ...@@ -366,18 +366,9 @@ module Gitlab
end end
end end
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/1233
def new_commits(newrev) def new_commits(newrev)
gitaly_migrate(:new_commits) do |is_enabled| wrapped_gitaly_errors do
if is_enabled gitaly_ref_client.list_new_commits(newrev)
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
end end
end end
......
...@@ -296,41 +296,31 @@ describe Repository do ...@@ -296,41 +296,31 @@ describe Repository do
end end
describe '#new_commits' do describe '#new_commits' do
shared_examples 'finding unreferenced commits' do set(:project) { create(:project, :repository) }
set(:project) { create(:project, :repository) } let(:repository) { project.repository }
let(:repository) { project.repository }
subject { repository.new_commits(rev) } subject { repository.new_commits(rev) }
context 'when there are no new commits' do context 'when there are no new commits' do
let(:rev) { repository.commit.id } let(:rev) { repository.commit.id }
it 'returns an empty array' do it 'returns an empty array' do
expect(subject).to eq([]) expect(subject).to eq([])
end
end end
end
context 'when new commits are found' do context 'when new commits are found' do
let(:branch) { 'orphaned-branch' } let(:branch) { 'orphaned-branch' }
let!(:rev) { repository.commit(branch).id } let!(:rev) { repository.commit(branch).id }
it 'returns the commits' do it 'returns the commits' do
repository.delete_branch(branch) repository.delete_branch(branch)
expect(subject).not_to be_empty expect(subject).not_to be_empty
expect(subject).to all( be_a(::Commit) ) expect(subject).to all( be_a(::Commit) )
expect(subject.size).to eq(1) expect(subject.size).to eq(1)
end
end end
end end
context 'when Gitaly handles the request' do
it_behaves_like 'finding unreferenced commits'
end
context 'when Gitaly is disabled', :disable_gitaly do
it_behaves_like 'finding unreferenced commits'
end
end end
describe '#commits_by' do describe '#commits_by' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment