Commit a9b2a274 authored by Gabriel Mazetto's avatar Gabriel Mazetto

Use `diff_base_commit` instead of `target_branch` to generate diffs

parent f7d20a6f
......@@ -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
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment