Move load_refs out of ApplicationController and into CommitsController
That was the only place it was used.
This commit is contained in:
parent
a9f275bc20
commit
5e1c63d3f0
|
@ -120,16 +120,6 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
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
|
def render_404
|
||||||
render file: File.join(Rails.root, "public", "404"), layout: false, status: "404"
|
render file: File.join(Rails.root, "public", "404"), layout: false, status: "404"
|
||||||
end
|
end
|
||||||
|
|
|
@ -59,7 +59,7 @@ class CommitsController < ApplicationController
|
||||||
|
|
||||||
def patch
|
def patch
|
||||||
@commit = project.commit(params[:id])
|
@commit = project.commit(params[:id])
|
||||||
|
|
||||||
send_data(
|
send_data(
|
||||||
@commit.to_patch,
|
@commit.to_patch,
|
||||||
type: "text/plain",
|
type: "text/plain",
|
||||||
|
@ -67,4 +67,16 @@ class CommitsController < ApplicationController
|
||||||
filename: (@commit.id.to_s + ".patch")
|
filename: (@commit.id.to_s + ".patch")
|
||||||
)
|
)
|
||||||
end
|
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
|
end
|
||||||
|
|
Loading…
Reference in a new issue