From 3b7c2adf0aead7438a0319d21a050c30b408c03a Mon Sep 17 00:00:00 2001 From: Riyad Preukschas Date: Thu, 22 Nov 2012 20:49:44 +0100 Subject: [PATCH] Add diff format to commit#show --- app/controllers/commit_controller.rb | 1 + spec/routing/project_routing_spec.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/app/controllers/commit_controller.rb b/app/controllers/commit_controller.rb index 50556954..d671e9f9 100644 --- a/app/controllers/commit_controller.rb +++ b/app/controllers/commit_controller.rb @@ -26,6 +26,7 @@ class CommitController < ProjectResourceController end end + format.diff { render text: @commit.to_diff } format.patch { render text: @commit.to_patch } end end diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb index dc687d2a..8f2bcb2b 100644 --- a/spec/routing/project_routing_spec.rb +++ b/spec/routing/project_routing_spec.rb @@ -285,6 +285,7 @@ end describe CommitController, "routing" do it "to #show" do get("/gitlabhq/commit/4246fb").should route_to('commit#show', project_id: 'gitlabhq', id: '4246fb') + get("/gitlabhq/commit/4246fb.diff").should route_to('commit#show', project_id: 'gitlabhq', id: '4246fb', format: 'diff') get("/gitlabhq/commit/4246fb.patch").should route_to('commit#show', project_id: 'gitlabhq', id: '4246fb', format: 'patch') get("/gitlabhq/commit/4246fbd13872934f72a8fd0d6fb1317b47b59cb5").should route_to('commit#show', project_id: 'gitlabhq', id: '4246fbd13872934f72a8fd0d6fb1317b47b59cb5') end