Commit 163ba813 authored by Dylan Griffith's avatar Dylan Griffith

Merge branch 'pks-ff-drop-list-commits' into 'master'

Remove `:list_commits` feature flag

See merge request gitlab-org/gitlab!66741
parents 9a177f6a e8a98485
---
name: list_commits
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/65468
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/335208
milestone: '14.1'
type: development
group: group::gitaly
default_enabled: false
......@@ -356,11 +356,7 @@ module Gitlab
def new_commits(newrevs)
wrapped_gitaly_errors do
if Feature.enabled?(:list_commits)
gitaly_commit_client.list_commits(Array.wrap(newrevs) + %w[--not --all])
else
Array.wrap(newrevs).flat_map { |newrev| gitaly_ref_client.list_new_commits(newrev) }
end
gitaly_commit_client.list_commits(Array.wrap(newrevs) + %w[--not --all])
end
end
......
......@@ -62,24 +62,6 @@ module Gitlab
encode!(response.name.dup)
end
def list_new_commits(newrev)
request = Gitaly::ListNewCommitsRequest.new(
repository: @gitaly_repo,
commit_id: newrev
)
commits = []
response = GitalyClient.call(@storage, :ref_service, :list_new_commits, request, timeout: GitalyClient.medium_timeout)
response.each do |msg|
msg.commits.each do |c|
commits << Gitlab::Git::Commit.new(@repository, c)
end
end
commits
end
def list_new_blobs(newrev, limit = 0, dynamic_timeout: nil)
request = Gitaly::ListNewBlobsRequest.new(
repository: @gitaly_repo,
......
......@@ -950,44 +950,23 @@ RSpec.describe Gitlab::Git::Repository, :seed_helper do
let(:expected_commits) { 1 }
let(:revisions) { [new_commit] }
shared_examples 'an enumeration of new commits' do
it 'enumerates commits' do
commits = repository.new_commits(revisions).to_a
expect(commits.size).to eq(expected_commits)
commits.each do |commit|
expect(commit.id).to eq(new_commit)
expect(commit.message).to eq("Message")
end
before do
expect_next_instance_of(Gitlab::GitalyClient::CommitService) do |service|
expect(service)
.to receive(:list_commits)
.with([new_commit, '--not', '--all'])
.and_call_original
end
end
context 'with list_commits disabled' do
before do
stub_feature_flags(list_commits: false)
it 'enumerates commits' do
commits = repository.new_commits(revisions).to_a
expect_next_instance_of(Gitlab::GitalyClient::RefService) do |service|
expect(service)
.to receive(:list_new_commits)
.with(new_commit)
.and_call_original
end
expect(commits.size).to eq(expected_commits)
commits.each do |commit|
expect(commit.id).to eq(new_commit)
expect(commit.message).to eq("Message")
end
it_behaves_like 'an enumeration of new commits'
end
context 'with list_commits enabled' do
before do
expect_next_instance_of(Gitlab::GitalyClient::CommitService) do |service|
expect(service)
.to receive(:list_commits)
.with([new_commit, '--not', '--all'])
.and_call_original
end
end
it_behaves_like 'an enumeration of new commits'
end
end
......
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