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
Tatuya Kamada
gitlab-ce
Commits
8ee3c28b
Commit
8ee3c28b
authored
Jul 11, 2016
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle more than two paths in MergeRequest#diffs
parent
93ab6860
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
app/controllers/concerns/diff_for_path.rb
app/controllers/concerns/diff_for_path.rb
+3
-1
app/models/merge_request_diff.rb
app/models/merge_request_diff.rb
+2
-3
No files found.
app/controllers/concerns/diff_for_path.rb
View file @
8ee3c28b
...
@@ -2,7 +2,9 @@ module DiffForPath
...
@@ -2,7 +2,9 @@ module DiffForPath
extend
ActiveSupport
::
Concern
extend
ActiveSupport
::
Concern
def
render_diff_for_path
(
diffs
,
diff_refs
,
project
)
def
render_diff_for_path
(
diffs
,
diff_refs
,
project
)
diff_file
=
safe_diff_files
(
diffs
,
diff_refs:
diff_refs
,
repository:
project
.
repository
).
first
diff_file
=
safe_diff_files
(
diffs
,
diff_refs:
diff_refs
,
repository:
project
.
repository
).
find
do
|
diff
|
diff
.
old_path
==
params
[
:old_path
]
&&
diff
.
new_path
==
params
[
:new_path
]
end
return
render_404
unless
diff_file
return
render_404
unless
diff_file
...
...
app/models/merge_request_diff.rb
View file @
8ee3c28b
...
@@ -145,10 +145,9 @@ class MergeRequestDiff < ActiveRecord::Base
...
@@ -145,10 +145,9 @@ class MergeRequestDiff < ActiveRecord::Base
def
load_diffs
(
raw
,
options
)
def
load_diffs
(
raw
,
options
)
if
raw
.
respond_to?
(
:each
)
if
raw
.
respond_to?
(
:each
)
if
options
[
:paths
]
if
paths
=
options
[
:paths
]
old_path
,
new_path
=
options
[
:paths
]
raw
=
raw
.
select
do
|
diff
|
raw
=
raw
.
select
do
|
diff
|
old_path
==
diff
[
:old_path
]
&&
new_path
==
diff
[
:new_path
]
paths
.
include?
(
diff
[
:old_path
])
||
paths
.
include?
(
diff
[
:new_path
])
end
end
end
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