Commit 41acc87f authored by Douwe Maan's avatar Douwe Maan
Browse files

Merge branch 'fix-follow-with-multiple-paths' into 'master'

Fix following with multiple paths

Closes gitlab-ee#2175

See merge request !10737
......@@ -108,7 +108,7 @@ def commits(ref, path: nil, limit: nil, offset: nil, skip_merges: false, after:
offset: offset,
after: after,
before: before,
follow: path.present?,
follow: Array(path).length == 1,
skip_merges: skip_merges
}
......
......@@ -171,6 +171,27 @@
end
end
describe '#commits' do
it 'sets follow when path is a single path' do
expect(Gitlab::Git::Commit).to receive(:where).with(a_hash_including(follow: true)).and_call_original.twice
repository.commits('master', path: 'README.md')
repository.commits('master', path: ['README.md'])
end
it 'does not set follow when path is multiple paths' do
expect(Gitlab::Git::Commit).to receive(:where).with(a_hash_including(follow: false)).and_call_original
repository.commits('master', path: ['README.md', 'CHANGELOG'])
end
it 'does not set follow when there are no paths' do
expect(Gitlab::Git::Commit).to receive(:where).with(a_hash_including(follow: false)).and_call_original
repository.commits('master')
end
end
describe '#find_commits_by_message' do
it 'returns commits with messages containing a given string' do
commit_ids = repository.find_commits_by_message('submodule').map(&:id)
......
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