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
746b6ec8
Commit
746b6ec8
authored
Nov 25, 2016
by
Yorick Peterse
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'timeout-merge-request-for-binary-file' into 'master'
Fix: Timeout creating and viewing merge request for binary file See merge request !7713
parents
d03ca3d0
847ada36
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
3 deletions
+21
-3
timeout-merge-request-for-binary-file.yml
...logs/unreleased/timeout-merge-request-for-binary-file.yml
+4
-0
merge_request_diff.rb
lib/gitlab/diff/file_collection/merge_request_diff.rb
+3
-3
merge_request_diff_spec.rb
...ib/gitlab/diff/file_collection/merge_request_diff_spec.rb
+13
-0
merge_request_diff_cache_service_spec.rb
...s/merge_requests/merge_request_diff_cache_service_spec.rb
+1
-0
No files found.
changelogs/unreleased/timeout-merge-request-for-binary-file.yml
0 → 100644
View file @
746b6ec8
---
title
:
Timeout creating and viewing merge request for binary file
merge_request
:
author
:
lib/gitlab/diff/file_collection/merge_request_diff.rb
View file @
746b6ec8
...
...
@@ -20,7 +20,7 @@ module Gitlab
# Extracted method to highlight in the same iteration to the diff_collection.
def
decorate_diff!
(
diff
)
diff_file
=
super
cache_highlight!
(
diff_file
)
if
cacheable?
cache_highlight!
(
diff_file
)
if
cacheable?
(
diff_file
)
diff_file
end
...
...
@@ -60,8 +60,8 @@ module Gitlab
Rails
.
cache
.
write
(
cache_key
,
highlight_cache
)
if
@highlight_cache_was_empty
end
def
cacheable?
@merge_request_diff
.
present?
def
cacheable?
(
diff_file
)
@merge_request_diff
.
present?
&&
diff_file
.
blob
.
text?
end
def
cache_key
...
...
spec/lib/gitlab/diff/file_collection/merge_request_diff_spec.rb
0 → 100644
View file @
746b6ec8
require
'spec_helper'
describe
Gitlab
::
Diff
::
FileCollection
::
MergeRequestDiff
do
let
(
:merge_request
)
{
create
:merge_request
}
it
'does not hightlight binary files'
do
allow_any_instance_of
(
Gitlab
::
Diff
::
File
).
to
receive
(
:blob
).
and_return
(
double
(
"text?"
=>
false
))
expect_any_instance_of
(
Gitlab
::
Diff
::
File
).
not_to
receive
(
:highlighted_diff_lines
)
described_class
.
new
(
merge_request
.
merge_request_diff
,
diff_options:
nil
).
diff_files
end
end
spec/services/merge_requests/merge_request_diff_cache_service_spec.rb
View file @
746b6ec8
...
...
@@ -10,6 +10,7 @@ describe MergeRequests::MergeRequestDiffCacheService do
expect
(
Rails
.
cache
).
to
receive
(
:read
).
with
(
cache_key
).
and_return
({})
expect
(
Rails
.
cache
).
to
receive
(
:write
).
with
(
cache_key
,
anything
)
allow_any_instance_of
(
Gitlab
::
Diff
::
File
).
to
receive
(
:blob
).
and_return
(
double
(
"text?"
=>
true
))
subject
.
execute
(
merge_request
)
end
...
...
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