Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
projects.thm.de
GitLab
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
extend
ActiveSupport
::
Concern
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
...
...
app/models/merge_request_diff.rb
View file @
8ee3c28b
...
...
@@ -145,10 +145,9 @@ def dump_diffs(diffs)
def
load_diffs
(
raw
,
options
)
if
raw
.
respond_to?
(
:each
)
if
options
[
:paths
]
old_path
,
new_path
=
options
[
:paths
]
if
paths
=
options
[
:paths
]
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
...
...
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