Commit 964f7110 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'fix_search' into 'master'

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

The issue was introduced in 8.12

Closes https://gitlab.com/gitlab-org/gitlab-ee/issues/1143

See merge request !811
parents 78b25cfa fc6228b4
......@@ -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)
- Decrease maximum time that GitLab waits for a mirror to finish !791 (Borja Aparicio)
- User groups (that can be assigned as approvers)
- Fix a search for non-default branches when ES is enabled
## 8.12.7
......
......@@ -105,7 +105,11 @@ module Gitlab
per_page: per_page
)
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
......
......@@ -63,6 +63,15 @@ describe Gitlab::Elastic::ProjectSearchResults, lib: true do
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
let(:query) { 'issue' }
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