Commit c4c7aa03 authored by Andy Soiron's avatar Andy Soiron

Merge branch 'pks-gitaly-commits-between-via-list-commits' into 'master'

gitaly_client: Reimplement `#between` via `#list_commits`

See merge request gitlab-org/gitlab!74273
parents 310e559c ebab4f48
---
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
......@@ -205,6 +205,8 @@ module Gitlab
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,
......
......@@ -112,15 +112,38 @@ RSpec.describe Gitlab::GitalyClient::CommitService do
let(:from) { 'master' }
let(:to) { Gitlab::Git::EMPTY_TREE_ID }
it 'sends an RPC request' do
request = Gitaly::CommitsBetweenRequest.new(
repository: repository_message, from: from, to: to
)
context 'with between_commits_via_list_commits enabled' do
before do
stub_feature_flags(between_commits_via_list_commits: true)
end
expect_any_instance_of(Gitaly::CommitService::Stub).to receive(:commits_between)
.with(request, kind_of(Hash)).and_return([])
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)
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
......
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