Commit c106bb70 authored by Nihad Abbasov's avatar Nihad Abbasov

minor refactoring of commits controller

parent e4447de2
...@@ -64,19 +64,14 @@ class CommitsController < ApplicationController ...@@ -64,19 +64,14 @@ class CommitsController < ApplicationController
@commit.to_patch, @commit.to_patch,
type: "text/plain", type: "text/plain",
disposition: 'attachment', disposition: 'attachment',
filename: (@commit.id.to_s + ".patch") filename: "#{@commit.id.patch}"
) )
end end
protected protected
def load_refs def load_refs
if params[:ref].blank? @ref ||= params[:ref].presence || params[:branch].presence || params[:tag].presence
@branch = params[:branch].blank? ? nil : params[:branch] @ref ||= @ref || @project.try(:default_branch) || 'master'
@tag = params[:tag].blank? ? nil : params[:tag]
@ref = @branch || @tag || @project.try(:default_branch) || 'master'
else
@ref = params[:ref]
end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment