Rename 'commits_between' to 'rugged_commits_between'

This commit is contained in:
Jacob Vosmaer 2017-08-03 15:47:43 +02:00
parent 23c502b434
commit 29a07fd3a1
3 changed files with 9 additions and 7 deletions

View file

@ -102,7 +102,7 @@ module Gitlab
if is_enabled
repo.gitaly_commit_client.between(base, head)
else
repo.commits_between(base, head).map { |c| decorate(c) }
repo.rugged_commits_between(base, head).map { |c| decorate(c) }
end
end
rescue Rugged::ReferenceError

View file

@ -327,7 +327,9 @@ module Gitlab
# Return a collection of Rugged::Commits between the two revspec arguments.
# See http://git-scm.com/docs/git-rev-parse.html#_specifying_revisions for
# a detailed list of valid arguments.
def commits_between(from, to)
#
# Gitaly note: JV: to be deprecated in favor of Commit.between
def rugged_commits_between(from, to)
walker = Rugged::Walker.new(rugged)
walker.sorting(Rugged::SORT_NONE | Rugged::SORT_REVERSE)

View file

@ -757,13 +757,13 @@ describe Gitlab::Git::Repository, seed_helper: true do
end
end
describe "#commits_between" do
describe "#rugged_commits_between" do
context 'two SHAs' do
let(:first_sha) { 'b0e52af38d7ea43cf41d8a6f2471351ac036d6c9' }
let(:second_sha) { '0e50ec4d3c7ce42ab74dda1d422cb2cbffe1e326' }
it 'returns the number of commits between' do
expect(repository.commits_between(first_sha, second_sha).count).to eq(3)
expect(repository.rugged_commits_between(first_sha, second_sha).count).to eq(3)
end
end
@ -772,11 +772,11 @@ describe Gitlab::Git::Repository, seed_helper: true do
let(:branch) { 'master' }
it 'returns the number of commits between a sha and a branch' do
expect(repository.commits_between(sha, branch).count).to eq(5)
expect(repository.rugged_commits_between(sha, branch).count).to eq(5)
end
it 'returns the number of commits between a branch and a sha' do
expect(repository.commits_between(branch, sha).count).to eq(0) # sha is before branch
expect(repository.rugged_commits_between(branch, sha).count).to eq(0) # sha is before branch
end
end
@ -785,7 +785,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
let(:second_branch) { 'master' }
it 'returns the number of commits between' do
expect(repository.commits_between(first_branch, second_branch).count).to eq(17)
expect(repository.rugged_commits_between(first_branch, second_branch).count).to eq(17)
end
end
end