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
iv
gitlab-ce
Commits
a9b2a274
Commit
a9b2a274
authored
Mar 29, 2016
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `diff_base_commit` instead of `target_branch` to generate diffs
parent
f7d20a6f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+2
-2
app/models/merge_request.rb
app/models/merge_request.rb
+4
-4
No files found.
app/controllers/projects/merge_requests_controller.rb
View file @
a9b2a274
...
...
@@ -57,8 +57,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
respond_to
do
|
format
|
format
.
html
format
.
json
{
render
json:
@merge_request
}
format
.
diff
{
render
text:
@merge_request
.
to_diff
(
current_user
)
}
format
.
patch
{
render
text:
@merge_request
.
to_patch
(
current_user
)
}
format
.
diff
{
render
text:
@merge_request
.
to_diff
}
format
.
patch
{
render
text:
@merge_request
.
to_patch
}
end
end
...
...
app/models/merge_request.rb
View file @
a9b2a274
...
...
@@ -331,15 +331,15 @@ class MergeRequest < ActiveRecord::Base
# Returns the raw diff for this merge request
#
# see "git diff"
def
to_diff
(
current_user
)
target_project
.
repository
.
diff_text
(
target_branch
,
source_sha
)
def
to_diff
target_project
.
repository
.
diff_text
(
diff_base_commit
,
source_sha
)
end
# Returns the commit as a series of email patches.
#
# see "git format-patch"
def
to_patch
(
current_user
)
target_project
.
repository
.
format_patch
(
target_branch
,
source_sha
)
def
to_patch
target_project
.
repository
.
format_patch
(
diff_base_commit
,
source_sha
)
end
def
hook_attrs
...
...
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