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
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
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
diff_for_path.rb
app/controllers/concerns/diff_for_path.rb
+3
-1
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 @@ class MergeRequestDiff < ActiveRecord::Base
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