Commit fc6228b4 authored by Valery Sizov's avatar Valery Sizov

Fix a search for non-default branches when ES is enabled

parent 78b25cfa
...@@ -11,6 +11,7 @@ Please view this file on the master branch, on stable branches it's out of date. ...@@ -11,6 +11,7 @@ Please view this file on the master branch, on stable branches it's out of date.
- Fix Git access panel for Wikis when Kerberos authentication is enabled (Borja Aparicio) - Fix Git access panel for Wikis when Kerberos authentication is enabled (Borja Aparicio)
- Decrease maximum time that GitLab waits for a mirror to finish !791 (Borja Aparicio) - Decrease maximum time that GitLab waits for a mirror to finish !791 (Borja Aparicio)
- User groups (that can be assigned as approvers) - User groups (that can be assigned as approvers)
- Fix a search for non-default branches when ES is enabled
## 8.12.7 ## 8.12.7
......
...@@ -105,7 +105,11 @@ module Gitlab ...@@ -105,7 +105,11 @@ module Gitlab
per_page: per_page per_page: per_page
) )
else else
project.repository.find_commits_by_message(query).compact Kaminari.paginate_array(
project.repository.find_commits_by_message(query).compact,
page: (page || 1).to_i,
per_page: per_page
)
end end
end end
end end
......
...@@ -63,6 +63,15 @@ describe Gitlab::Elastic::ProjectSearchResults, lib: true do ...@@ -63,6 +63,15 @@ describe Gitlab::Elastic::ProjectSearchResults, lib: true do
end end
end end
describe "search for commits in non-default branch" do
it "finds needed commit" do
project = create :project
result = Gitlab::Elastic::ProjectSearchResults.new(user, "initial", project.id, 'test')
expect(result.commits_count).to eq(1)
end
end
describe 'confidential issues' do describe 'confidential issues' do
let(:query) { 'issue' } let(:query) { 'issue' }
let(:author) { create(:user) } let(:author) { create(:user) }
......
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