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
78496e8c
Commit
78496e8c
authored
Jun 30, 2016
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable overflow messages
With the option to expand and collapse individual diffs, these aren't needed any more.
parent
b6b26692
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
3 additions
and
58 deletions
+3
-58
diff_helper.rb
app/helpers/diff_helper.rb
+1
-9
_text_file.html.haml
app/views/projects/diffs/_text_file.html.haml
+1
-6
_warning.html.haml
app/views/projects/diffs/_warning.html.haml
+0
-3
commits.feature
features/project/commits/commits.feature
+0
-5
commits.rb
features/steps/project/commits/commits.rb
+0
-19
diff_helper_spec.rb
spec/helpers/diff_helper_spec.rb
+1
-16
No files found.
app/helpers/diff_helper.rb
View file @
78496e8c
...
...
@@ -37,16 +37,8 @@ module DiffHelper
end
end
def
diff_hard_limit_enabled?
params
[
:force_show_diff
].
present?
end
def
diff_options
options
=
{
ignore_whitespace_change:
hide_whitespace?
}
if
diff_hard_limit_enabled?
options
.
merge!
(
Commit
.
max_diff_options
)
end
options
Commit
.
max_diff_options
.
merge
(
ignore_whitespace_change:
hide_whitespace?
)
end
def
safe_diff_files
(
diffs
,
diff_refs:
nil
,
repository:
nil
)
...
...
app/views/projects/diffs/_text_file.html.haml
View file @
78496e8c
-
too_big
=
diff_file
.
diff_lines
.
count
>
Commit
::
DIFF_SAFE_LINES
-
if
too_big
.suppressed-container
%a
.show-suppressed-diff.js-show-suppressed-diff
Changes suppressed. Click to show.
%table
.text-file.code.js-syntax-highlight
{
class:
too_big
?
'hide'
:
''
}
%table
.text-file.code.js-syntax-highlight
-
last_line
=
0
-
diff_file
.
highlighted_diff_lines
.
each
do
|
line
|
-
last_line
=
line
.
new_pos
...
...
app/views/projects/diffs/_warning.html.haml
View file @
78496e8c
...
...
@@ -2,9 +2,6 @@
%h4
Too many changes to show.
.pull-right
-
unless
diff_hard_limit_enabled?
=
link_to
"Reload with full diff"
,
url_for
(
params
.
merge
(
force_show_diff:
true
,
format:
nil
)),
class:
"btn btn-sm"
-
if
current_controller?
(
:commit
)
or
current_controller?
(
:merge_requests
)
-
if
current_controller?
(
:commit
)
=
link_to
"Plain diff"
,
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
@commit
,
format: :diff
),
class:
"btn btn-sm"
...
...
features/project/commits/commits.feature
View file @
78496e8c
...
...
@@ -83,11 +83,6 @@ Feature: Project Commits
#Given I visit my project's commits stats page
#Then I see commits stats
Scenario
:
I
browse big commit
Given
I visit big commit page
Then
I see big commit warning
And
I see
"Reload with full diff"
link
Scenario
:
I
browse a commit with an image
Given
I visit a commit with an image that changed
Then
The diff links to both the previous and current image
...
...
features/steps/project/commits/commits.rb
View file @
78496e8c
...
...
@@ -125,25 +125,6 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
expect
(
page
).
to
have_content
'Authors'
end
step
'I visit big commit page'
do
# Create a temporary scope to ensure that the stub_const is removed after user
RSpec
::
Mocks
.
with_temporary_scope
do
stub_const
(
'Gitlab::Git::DiffCollection::DEFAULT_LIMITS'
,
{
max_lines:
1
,
max_files:
1
})
visit
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
sample_big_commit
.
id
)
end
end
step
'I see big commit warning'
do
expect
(
page
).
to
have_content
sample_big_commit
.
message
expect
(
page
).
to
have_content
"Too many changes"
end
step
'I see "Reload with full diff" link'
do
link
=
find_link
(
'Reload with full diff'
)
expect
(
link
[
:href
]).
to
end_with
(
'?force_show_diff=true'
)
expect
(
link
[
:href
]).
not_to
include
(
'.html'
)
end
step
'I visit a commit with an image that changed'
do
visit
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
sample_image_commit
.
id
)
end
...
...
spec/helpers/diff_helper_spec.rb
View file @
78496e8c
...
...
@@ -31,26 +31,11 @@ describe DiffHelper do
end
end
describe
'diff_hard_limit_enabled?'
do
it
'should return true if param is provided'
do
allow
(
controller
).
to
receive
(
:params
)
{
{
force_show_diff:
true
}
}
expect
(
diff_hard_limit_enabled?
).
to
be_truthy
end
it
'should return false if param is not provided'
do
expect
(
diff_hard_limit_enabled?
).
to
be_falsey
end
end
describe
'diff_options'
do
it
'should return hard limit for a diff
if force diff is true
'
do
it
'should return hard limit for a diff'
do
allow
(
controller
).
to
receive
(
:params
)
{
{
force_show_diff:
true
}
}
expect
(
diff_options
).
to
include
(
Commit
.
max_diff_options
)
end
it
'should return safe limit for a diff if force diff is false'
do
expect
(
diff_options
).
not_to
include
(
:max_lines
,
:max_files
)
end
end
describe
'unfold_bottom_class'
do
...
...
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