From c106bb7096e3bb8bada454dcf7794877204f0e34 Mon Sep 17 00:00:00 2001 From: Nihad Abbasov Date: Thu, 6 Sep 2012 04:03:46 -0700 Subject: [PATCH] minor refactoring of commits controller --- app/controllers/commits_controller.rb | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/app/controllers/commits_controller.rb b/app/controllers/commits_controller.rb index 5e10a1b6ee7..4ab40c304dd 100644 --- a/app/controllers/commits_controller.rb +++ b/app/controllers/commits_controller.rb @@ -64,19 +64,14 @@ class CommitsController < ApplicationController @commit.to_patch, type: "text/plain", disposition: 'attachment', - filename: (@commit.id.to_s + ".patch") + filename: "#{@commit.id.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 + @ref ||= params[:ref].presence || params[:branch].presence || params[:tag].presence + @ref ||= @ref || @project.try(:default_branch) || 'master' end end