summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2018-08-14 09:14:23 +0000
committerDouwe Maan <douwe@gitlab.com>2018-08-14 09:14:23 +0000
commitbbbcb9142e17a27c8a5e1fb307a2ae56ce3f09b4 (patch)
treedd802d44fffca5f835c278cedc0b9b8a496b070b
parentd9614e701a932881e3b64a1785f91e524499541d (diff)
parent5ddc9ad0b92dd057354298d61ab03ae4076ac7f2 (diff)
downloadgitlab-ce-bbbcb9142e17a27c8a5e1fb307a2ae56ce3f09b4.tar.gz
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
-rw-r--r--lib/gitlab/git/repository.rb13
-rw-r--r--spec/models/repository_spec.rb42
2 files changed, 18 insertions, 37 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb
index 3e11355435b..e9c901f8592 100644
--- a/lib/gitlab/git/repository.rb
+++ b/lib/gitlab/git/repository.rb
@@ -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
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index 52ec8dbe25a..2859d5149ec 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -296,41 +296,31 @@ 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
+ 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 }
+ 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)
+ 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
+ expect(subject).not_to be_empty
+ expect(subject).to all( be_a(::Commit) )
+ expect(subject.size).to eq(1)
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
describe '#commits_by' do