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
Léo-Paul Géneau
gitlab-ce
Commits
de1db497
Commit
de1db497
authored
Nov 01, 2018
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoidp loading merge request diff files when not needed
parent
0844ba04
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
app/services/merge_requests/reload_diffs_service.rb
app/services/merge_requests/reload_diffs_service.rb
+1
-1
lib/gitlab/diff/file_collection/base.rb
lib/gitlab/diff/file_collection/base.rb
+5
-2
No files found.
app/services/merge_requests/reload_diffs_service.rb
View file @
de1db497
...
@@ -38,7 +38,7 @@ module MergeRequests
...
@@ -38,7 +38,7 @@ module MergeRequests
# reloading the diff.
# reloading the diff.
MergeRequestDiff
MergeRequestDiff
.
where
(
merge_request:
merge_request
)
.
where
(
merge_request:
merge_request
)
.
preload
(
:merge_request_diff_files
,
merge_request: :target_project
)
.
preload
(
merge_request: :target_project
)
.
find_each
do
|
merge_request_diff
|
.
find_each
do
|
merge_request_diff
|
next
if
merge_request_diff
==
new_diff
next
if
merge_request_diff
==
new_diff
...
...
lib/gitlab/diff/file_collection/base.rb
View file @
de1db497
...
@@ -17,7 +17,6 @@ module Gitlab
...
@@ -17,7 +17,6 @@ module Gitlab
@diffable
=
diffable
@diffable
=
diffable
@include_stats
=
diff_options
.
delete
(
:include_stats
)
@include_stats
=
diff_options
.
delete
(
:include_stats
)
@diffs
=
diffable
.
raw_diffs
(
diff_options
)
@project
=
project
@project
=
project
@diff_options
=
diff_options
@diff_options
=
diff_options
@diff_refs
=
diff_refs
@diff_refs
=
diff_refs
...
@@ -25,8 +24,12 @@ module Gitlab
...
@@ -25,8 +24,12 @@ module Gitlab
@repository
=
project
.
repository
@repository
=
project
.
repository
end
end
def
diffs
@diffs
||=
diffable
.
raw_diffs
(
diff_options
)
end
def
diff_files
def
diff_files
@diff_files
||=
@
diffs
.
decorate!
{
|
diff
|
decorate_diff!
(
diff
)
}
@diff_files
||=
diffs
.
decorate!
{
|
diff
|
decorate_diff!
(
diff
)
}
end
end
def
diff_file_with_old_path
(
old_path
)
def
diff_file_with_old_path
(
old_path
)
...
...
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