BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
401b51f7
Commit
401b51f7
authored
Feb 23, 2017
by
Sean McGivern
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix-mr-size-with-over-100-files' into 'master'
Fix MR changes tab size count Closes #27563 See merge request !9091
parents
fae2650c
5a2c6881
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
1 deletion
+53
-1
merge_request.rb
app/models/merge_request.rb
+5
-1
fix-mr-size-with-over-100-files.yml
changelogs/unreleased/fix-mr-size-with-over-100-files.yml
+4
-0
merge_request_spec.rb
spec/models/merge_request_spec.rb
+44
-0
No files found.
app/models/merge_request.rb
View file @
401b51f7
...
...
@@ -203,7 +203,11 @@ class MergeRequest < ActiveRecord::Base
end
def
diff_size
opts
=
diff_options
||
{}
# The `#diffs` method ends up at an instance of a class inheriting from
# `Gitlab::Diff::FileCollection::Base`, so use those options as defaults
# here too, to get the same diff size without performing highlighting.
#
opts
=
Gitlab
::
Diff
::
FileCollection
::
Base
.
default_options
.
merge
(
diff_options
||
{})
raw_diffs
(
opts
).
size
end
...
...
changelogs/unreleased/fix-mr-size-with-over-100-files.yml
0 → 100644
View file @
401b51f7
---
title
:
Fix MR changes tab size count when there are over 100 files in the diff
merge_request
:
author
:
spec/models/merge_request_spec.rb
View file @
401b51f7
...
...
@@ -209,6 +209,50 @@ describe MergeRequest, models: true do
end
end
describe
'#diff_size'
do
let
(
:merge_request
)
do
build
(
:merge_request
,
source_branch:
'expand-collapse-files'
,
target_branch:
'master'
)
end
context
'when there are MR diffs'
do
before
do
merge_request
.
save
end
it
'returns the correct count'
do
expect
(
merge_request
.
diff_size
).
to
eq
(
105
)
end
it
'does not perform highlighting'
do
expect
(
Gitlab
::
Diff
::
Highlight
).
not_to
receive
(
:new
)
merge_request
.
diff_size
end
end
context
'when there are no MR diffs'
do
before
do
merge_request
.
compare
=
CompareService
.
new
(
merge_request
.
source_project
,
merge_request
.
source_branch
).
execute
(
merge_request
.
target_project
,
merge_request
.
target_branch
)
end
it
'returns the correct count'
do
expect
(
merge_request
.
diff_size
).
to
eq
(
105
)
end
it
'does not perform highlighting'
do
expect
(
Gitlab
::
Diff
::
Highlight
).
not_to
receive
(
:new
)
merge_request
.
diff_size
end
end
end
describe
"#related_notes"
do
let!
(
:merge_request
)
{
create
(
:merge_request
)
}
...
...
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