summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <zegerjan@gitlab.com>2016-05-12 20:50:49 +0200
committerZ.J. van de Weg <zegerjan@gitlab.com>2016-06-03 18:43:22 +0200
commit01e1139f68066e46b86ef92749513377eee63f5b (patch)
treeb5ca525894fa2c548dce2b357f0b5419ee719388 /app/controllers
parentca3c5c295ed653b483fe81c3918ffe60f46666b9 (diff)
downloadgitlab-ce-01e1139f68066e46b86ef92749513377eee63f5b.tar.gz
Workhorse to serve raw diffs
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/projects/merge_requests_controller.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb
index 3142fe5c767..fe811f30c03 100644
--- a/app/controllers/projects/merge_requests_controller.rb
+++ b/app/controllers/projects/merge_requests_controller.rb
@@ -57,9 +57,16 @@ 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 }
- format.patch { render text: @merge_request.to_patch }
+ format.json { render json: @merge_request }
+ format.patch { render text: @merge_request.to_patch }
+ format.diff do
+ headers.store(*Gitlab::Workhorse.send_git_diff(@project.repository,
+ @merge_request.diff_base_commit.id,
+ @merge_request.last_commit.id))
+ headers['Content-Disposition'] = 'inline'
+
+ head :ok
+ end
end
end