Previously this class would be given a project ID which was then used to
retrieve the corresponding Project object. However, in all cases the
Project object was already known as it was used to grab the ID to pass
to ProjectSearchResults. By just passing a Project instead we remove the
need for an extra query as well as the need for some other complexity
in this class.
Include the log messages of recent commits in project-level search
results, providing functionality similar to 'git log --grep'.
Update repository model rspec tests to validate the output of
Repository#commits_with_log_matching.
There is no need to check if `repository_ref` is present as:
```
@repository_ref = if repository_ref.present?
repository_ref
else
nil
end
```
is as same as doing:
```
@repository_ref = repository_ref
```
Gitlab::SearchResults and Gitlab::ProjectSearchResults are libraries we
are going to use to get search results based on query, enitity type and
pagination.
It will allow us to get only issues from project #23 where title or
description includes 'foo'.
Ex:
search_results = Gitlab::ProjectSearchResults.new(project.id, 'foo', 'issues')
search_results.objects => # [<Issues #23>, <Issues #34>]
search_results.issues_count => 2
search_results.total_count => 12 (it includes results from comments and
merge requests too)
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>