Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
2514cd9c
Commit
2514cd9c
authored
May 20, 2020
by
Alishan Ladhani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Format the number of commit results according to convention
parent
6668e7eb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
lib/gitlab/project_search_results.rb
lib/gitlab/project_search_results.rb
+3
-3
spec/lib/gitlab/project_search_results_spec.rb
spec/lib/gitlab/project_search_results_spec.rb
+14
-1
No files found.
lib/gitlab/project_search_results.rb
View file @
2514cd9c
...
...
@@ -37,7 +37,7 @@ module Gitlab
when
'wiki_blobs'
wiki_blobs_count
.
to_s
when
'commits'
commits_count
.
to_s
formatted_limited_count
(
commits_count
)
else
super
end
...
...
@@ -72,7 +72,7 @@ module Gitlab
end
def
commits_count
@commits_count
||=
commits
.
count
@commits_count
||=
commits
(
limit:
count_limit
)
.
count
end
def
single_commit_result?
...
...
@@ -145,7 +145,7 @@ module Gitlab
end
# rubocop: enable CodeReuse/ActiveRecord
def
commits
(
limit:
count_limit
)
def
commits
(
limit
:)
@commits
||=
find_commits
(
query
,
limit:
limit
)
end
...
...
spec/lib/gitlab/project_search_results_spec.rb
View file @
2514cd9c
...
...
@@ -34,7 +34,7 @@ describe Gitlab::ProjectSearchResults do
'blobs'
|
:limited_blobs_count
|
max_limited_count
'notes'
|
:limited_notes_count
|
max_limited_count
'wiki_blobs'
|
:wiki_blobs_count
|
'1234'
'commits'
|
:commits_count
|
'1234'
'commits'
|
:commits_count
|
max_limited_count
'projects'
|
:limited_projects_count
|
max_limited_count
'unknown'
|
nil
|
nil
end
...
...
@@ -386,6 +386,19 @@ describe Gitlab::ProjectSearchResults do
end
end
describe
'#commits_count'
do
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
it
'limits the number of commits requested'
do
expect
(
project
.
repository
)
.
to
receive
(
:find_commits_by_message
)
.
with
(
anything
,
anything
,
anything
,
described_class
::
COUNT_LIMIT
)
.
and_call_original
described_class
.
new
(
user
,
project
,
'.'
).
commits_count
end
end
# Examples for commit access level test
#
# params:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment