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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
9b42be02
Commit
9b42be02
authored
Jun 09, 2017
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only look up diff size limit flags once per request
parent
8ce11fc3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
lib/gitlab/git/diff.rb
lib/gitlab/git/diff.rb
+18
-2
No files found.
lib/gitlab/git/diff.rb
View file @
9b42be02
...
@@ -23,6 +23,23 @@ module Gitlab
...
@@ -23,6 +23,23 @@ module Gitlab
class
<<
self
class
<<
self
# The maximum size of a diff to display.
# The maximum size of a diff to display.
def
size_limit
def
size_limit
if
RequestStore
.
active?
RequestStore
[
'gitlab_git_diff_size_limit'
]
||=
find_size_limit
else
find_size_limit
end
end
# The maximum size before a diff is collapsed.
def
collapse_limit
if
RequestStore
.
active?
RequestStore
[
'gitlab_git_diff_collapse_limit'
]
||=
find_collapse_limit
else
find_collapse_limit
end
end
def
find_size_limit
if
Feature
.
enabled?
(
'gitlab_git_diff_size_limit_increase'
)
if
Feature
.
enabled?
(
'gitlab_git_diff_size_limit_increase'
)
200
.
kilobytes
200
.
kilobytes
else
else
...
@@ -30,8 +47,7 @@ module Gitlab
...
@@ -30,8 +47,7 @@ module Gitlab
end
end
end
end
# The maximum size before a diff is collapsed.
def
find_collapse_limit
def
collapse_limit
if
Feature
.
enabled?
(
'gitlab_git_diff_size_limit_increase'
)
if
Feature
.
enabled?
(
'gitlab_git_diff_size_limit_increase'
)
100
.
kilobytes
100
.
kilobytes
else
else
...
...
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