Commit 3b7c2adf0aead7438a0319d21a050c30b408c03a

Authored by Riyad Preukschas
1 parent 246faa3d

Add diff format to commit#show

app/controllers/commit_controller.rb
@@ -26,6 +26,7 @@ class CommitController < ProjectResourceController @@ -26,6 +26,7 @@ class CommitController < ProjectResourceController
26 end 26 end
27 end 27 end
28 28
  29 + format.diff { render text: @commit.to_diff }
29 format.patch { render text: @commit.to_patch } 30 format.patch { render text: @commit.to_patch }
30 end 31 end
31 end 32 end
spec/routing/project_routing_spec.rb
@@ -285,6 +285,7 @@ end @@ -285,6 +285,7 @@ end
285 describe CommitController, "routing" do 285 describe CommitController, "routing" do
286 it "to #show" do 286 it "to #show" do
287 get("/gitlabhq/commit/4246fb").should route_to('commit#show', project_id: 'gitlabhq', id: '4246fb') 287 get("/gitlabhq/commit/4246fb").should route_to('commit#show', project_id: 'gitlabhq', id: '4246fb')
  288 + get("/gitlabhq/commit/4246fb.diff").should route_to('commit#show', project_id: 'gitlabhq', id: '4246fb', format: 'diff')
288 get("/gitlabhq/commit/4246fb.patch").should route_to('commit#show', project_id: 'gitlabhq', id: '4246fb', format: 'patch') 289 get("/gitlabhq/commit/4246fb.patch").should route_to('commit#show', project_id: 'gitlabhq', id: '4246fb', format: 'patch')
289 get("/gitlabhq/commit/4246fbd13872934f72a8fd0d6fb1317b47b59cb5").should route_to('commit#show', project_id: 'gitlabhq', id: '4246fbd13872934f72a8fd0d6fb1317b47b59cb5') 290 get("/gitlabhq/commit/4246fbd13872934f72a8fd0d6fb1317b47b59cb5").should route_to('commit#show', project_id: 'gitlabhq', id: '4246fbd13872934f72a8fd0d6fb1317b47b59cb5')
290 end 291 end