Commit 2e417f1c authored by Patrick Steinhardt's avatar Patrick Steinhardt

Remove unused CommitsBetween wrapper

In commit ebab4f48 (gitaly_client: Reimplement `#between` via
`#list_commits`, 2021-11-11), we have reimplemented `#between` via
`#list_commits` such that the deprecated CommitsBetween RPC isn't used
in GitLab Rails anymore. What was missed though is that `#between` isn't
being used at all anymore, and all previous callsites had already been
converted to use `#list_commits` in the first place. The calls which
were still visible in Grafana thus weren't caused by Rails, but they
were instead caused by the Elasticsearch indexer.

Remove `#between` altogether given that it's not in use. The feature
flag which has been introduced to convert this wrapper to instead use
`#list_commits` is removed, too.

Changelog: other
parent bf99494f
---
name: between_commits_via_list_commits
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/74273
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/345458
milestone: '14.5'
type: development
group: group::gitaly
default_enabled: false
......@@ -204,19 +204,6 @@ module Gitlab
Gitlab::Git::Commit.new(@repository, gitaly_commit)
end
def between(from, to)
return list_commits(["^" + from, to], reverse: true) if Feature.enabled?(:between_commits_via_list_commits)
request = Gitaly::CommitsBetweenRequest.new(
repository: @gitaly_repo,
from: from,
to: to
)
response = GitalyClient.call(@repository.storage, :commit_service, :commits_between, request, timeout: GitalyClient.medium_timeout)
consume_commits_response(response)
end
def diff_stats(left_commit_sha, right_commit_sha)
request = Gitaly::DiffStatsRequest.new(
repository: @gitaly_repo,
......
......@@ -108,45 +108,6 @@ RSpec.describe Gitlab::GitalyClient::CommitService do
end
end
describe '#between' do
let(:from) { 'master' }
let(:to) { Gitlab::Git::EMPTY_TREE_ID }
context 'with between_commits_via_list_commits enabled' do
before do
stub_feature_flags(between_commits_via_list_commits: true)
end
it 'sends an RPC request' do
request = Gitaly::ListCommitsRequest.new(
repository: repository_message, revisions: ["^" + from, to], reverse: true
)
expect_any_instance_of(Gitaly::CommitService::Stub).to receive(:list_commits)
.with(request, kind_of(Hash)).and_return([])
described_class.new(repository).between(from, to)
end
end
context 'with between_commits_via_list_commits disabled' do
before do
stub_feature_flags(between_commits_via_list_commits: false)
end
it 'sends an RPC request' do
request = Gitaly::CommitsBetweenRequest.new(
repository: repository_message, from: from, to: to
)
expect_any_instance_of(Gitaly::CommitService::Stub).to receive(:commits_between)
.with(request, kind_of(Hash)).and_return([])
described_class.new(repository).between(from, to)
end
end
end
describe '#diff_stats' do
let(:left_commit_id) { 'master' }
let(:right_commit_id) { 'cfe32cf61b73a0d5e9f13e774abde7ff789b1660' }
......
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