summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2012-09-05 01:13:41 -0400
committerRobert Speicher <rspeicher@gmail.com>2012-09-05 01:13:41 -0400
commit5e1c63d3f0f0729a1d9d9e19c64b2fef65cc30fb (patch)
tree0644b7101571e3229ac05f07cd0ba8bfd6b5799c
parenta9f275bc201e666b9f26768aa228aca8250d5a94 (diff)
downloadgitlab-ce-5e1c63d3f0f0729a1d9d9e19c64b2fef65cc30fb.tar.gz
Move load_refs out of ApplicationController and into CommitsController
That was the only place it was used.
-rw-r--r--app/controllers/application_controller.rb10
-rw-r--r--app/controllers/commits_controller.rb14
2 files changed, 13 insertions, 11 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index dae2e906256..7e53b8fe5ff 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -120,16 +120,6 @@ class ApplicationController < ActionController::Base
end
end
- def load_refs
- if params[:ref].blank?
- @branch = params[:branch].blank? ? nil : params[:branch]
- @tag = params[:tag].blank? ? nil : params[:tag]
- @ref = @branch || @tag || @project.try(:default_branch) || 'master'
- else
- @ref = params[:ref]
- end
- end
-
def render_404
render file: File.join(Rails.root, "public", "404"), layout: false, status: "404"
end
diff --git a/app/controllers/commits_controller.rb b/app/controllers/commits_controller.rb
index 717912d9e92..5e10a1b6ee7 100644
--- a/app/controllers/commits_controller.rb
+++ b/app/controllers/commits_controller.rb
@@ -59,7 +59,7 @@ class CommitsController < ApplicationController
def patch
@commit = project.commit(params[:id])
-
+
send_data(
@commit.to_patch,
type: "text/plain",
@@ -67,4 +67,16 @@ class CommitsController < ApplicationController
filename: (@commit.id.to_s + ".patch")
)
end
+
+ protected
+
+ def load_refs
+ if params[:ref].blank?
+ @branch = params[:branch].blank? ? nil : params[:branch]
+ @tag = params[:tag].blank? ? nil : params[:tag]
+ @ref = @branch || @tag || @project.try(:default_branch) || 'master'
+ else
+ @ref = params[:ref]
+ end
+ end
end