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
Jérome Perrin
gitlab-ce
Commits
6d0dcb66
Commit
6d0dcb66
authored
Oct 25, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce max commit diff size. Added Commit::DIFF_SAFE_SIZE
parent
1ea0dd0f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
5 deletions
+11
-5
app/assets/stylesheets/gitlab_bootstrap/common.scss
app/assets/stylesheets/gitlab_bootstrap/common.scss
+1
-0
app/contexts/commit_load_context.rb
app/contexts/commit_load_context.rb
+1
-1
app/models/commit.rb
app/models/commit.rb
+5
-0
app/views/commits/_diffs.html.haml
app/views/commits/_diffs.html.haml
+4
-4
No files found.
app/assets/stylesheets/gitlab_bootstrap/common.scss
View file @
6d0dcb66
...
...
@@ -26,6 +26,7 @@
.underlined
{
border-bottom
:
1px
solid
#CCC
;
}
.no-borders
{
border
:none
;
}
.vlink
{
color
:
$link_color
!
important
;
}
.underlined_link
{
text-decoration
:
underline
;
}
.borders
{
border
:
1px
solid
#ccc
;
@include
shade
;
}
.hint
{
font-style
:
italic
;
color
:
#999
;
}
...
...
app/contexts/commit_load_context.rb
View file @
6d0dcb66
...
...
@@ -21,7 +21,7 @@ class CommitLoadContext < BaseContext
result
[
:notes_count
]
=
line_notes
.
count
+
project
.
commit_notes
(
commit
).
count
begin
result
[
:suppress_diff
]
=
true
if
commit
.
diffs
.
size
>
200
&&
!
params
[
:force_show_diff
]
result
[
:suppress_diff
]
=
true
if
commit
.
diffs
.
size
>
Commit
::
DIFF_SAFE_SIZE
&&
!
params
[
:force_show_diff
]
rescue
Grit
::
Git
::
GitTimeout
result
[
:suppress_diff
]
=
true
result
[
:status
]
=
:huge_commit
...
...
app/models/commit.rb
View file @
6d0dcb66
...
...
@@ -4,6 +4,11 @@ class Commit
include
StaticModel
extend
ActiveModel
::
Naming
# Safe amount of files with diffs in one commit to render
# Used to prevent 500 error on huge commits by suppressing diff
#
DIFF_SAFE_SIZE
=
100
attr_accessor
:commit
,
:head
,
:refs
delegate
:message
,
:authored_date
,
:committed_date
,
:parents
,
:sha
,
...
...
app/views/commits/_diffs.html.haml
View file @
6d0dcb66
-
if
@suppress_diff
.alert-message.block-message
%p
%strong
Warning! Large commit with more then
200
files changed.
%strong
Warning! Large commit with more then
#{
Commit
::
DIFF_SAFE_SIZE
}
files changed.
%p
To prevent performance issue we rejected diff information.
%p
But if you still want to see diff
=
link_to
"click this link"
,
project_commit_path
(
@project
,
@commit
,
force_show_diff:
true
),
class:
"
dar
k"
=
link_to
"click this link"
,
project_commit_path
(
@project
,
@commit
,
force_show_diff:
true
),
class:
"
underlined_lin
k"
%p
.cgray
Showing
#{
pluralize
(
diffs
.
count
,
"changed file"
)
}
...
...
@@ -35,10 +35,10 @@
-
if
file
.
text?
=
render
"commits/text_file"
,
diff:
diff
,
index:
i
-
elsif
file
.
image?
-
if
diff
.
renamed_file
||
diff
.
new_file
||
diff
.
deleted_file
-
if
diff
.
renamed_file
||
diff
.
new_file
||
diff
.
deleted_file
.diff_file_content_image
%img
{
class:
image_diff_class
(
diff
),
src:
"data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"
}
-
else
-
else
-
old_file
=
(
@commit
.
prev_commit
.
tree
/
diff
.
old_path
)
.diff_file_content_image.img_compared
%img
{
class:
"diff_image_removed"
,
src:
"data:#{file.mime_type};base64,#{Base64.encode64(old_file.data)}"
}
...
...
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