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
2c0de7aa
Commit
2c0de7aa
authored
Mar 31, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cache MR diffs by diff refs
parent
b202b42c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
app/models/merge_request.rb
app/models/merge_request.rb
+5
-1
lib/gitlab/diff/diff_refs.rb
lib/gitlab/diff/diff_refs.rb
+6
-0
No files found.
app/models/merge_request.rb
View file @
2c0de7aa
...
...
@@ -368,7 +368,11 @@ class MergeRequest < ActiveRecord::Base
end
def
merge_request_diff_for
(
diff_refs
)
merge_request_diffs
.
viewable
.
select_without_diff
.
with_diff_refs
(
diff_refs
).
take
@merge_request_diffs_by_diff_refs
||=
Hash
.
new
do
|
h
,
diff_refs
|
h
[
diff_refs
]
=
merge_request_diffs
.
viewable
.
select_without_diff
.
with_diff_refs
(
diff_refs
).
take
end
@merge_request_diffs_by_diff_refs
[
diff_refs
]
end
def
reload_diff_if_branch_changed
...
...
lib/gitlab/diff/diff_refs.rb
View file @
2c0de7aa
...
...
@@ -18,6 +18,12 @@ module Gitlab
head_sha
==
other
.
head_sha
end
alias_method
:eql?
,
:==
def
hash
[
base_sha
,
start_sha
,
head_sha
].
hash
end
# There is only one case in which we will have `start_sha` and `head_sha`,
# but not `base_sha`, which is when a diff is generated between an
# orphaned branch and another branch, which means there _is_ no base, but
...
...
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