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
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
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+2
-2
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
...
@@ -57,8 +57,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
format
.
html
format
.
json
{
render
json:
@merge_request
}
format
.
json
{
render
json:
@merge_request
}
format
.
diff
{
render
text:
@merge_request
.
to_diff
(
current_user
)
}
format
.
diff
{
render
text:
@merge_request
.
to_diff
}
format
.
patch
{
render
text:
@merge_request
.
to_patch
(
current_user
)
}
format
.
patch
{
render
text:
@merge_request
.
to_patch
}
end
end
end
end
...
...
app/models/merge_request.rb
View file @
a9b2a274
...
@@ -331,15 +331,15 @@ class MergeRequest < ActiveRecord::Base
...
@@ -331,15 +331,15 @@ class MergeRequest < ActiveRecord::Base
# Returns the raw diff for this merge request
# Returns the raw diff for this merge request
#
#
# see "git diff"
# see "git diff"
def
to_diff
(
current_user
)
def
to_diff
target_project
.
repository
.
diff_text
(
target_branch
,
source_sha
)
target_project
.
repository
.
diff_text
(
diff_base_commit
,
source_sha
)
end
end
# Returns the commit as a series of email patches.
# Returns the commit as a series of email patches.
#
#
# see "git format-patch"
# see "git format-patch"
def
to_patch
(
current_user
)
def
to_patch
target_project
.
repository
.
format_patch
(
target_branch
,
source_sha
)
target_project
.
repository
.
format_patch
(
diff_base_commit
,
source_sha
)
end
end
def
hook_attrs
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