Commit c106bb7096e3bb8bada454dcf7794877204f0e34
1 parent
e4447de2
Exists in
master
and in
4 other branches
minor refactoring of commits controller
Showing
1 changed file
with
3 additions
and
8 deletions
Show diff stats
app/controllers/commits_controller.rb
| @@ -64,19 +64,14 @@ class CommitsController < ApplicationController | @@ -64,19 +64,14 @@ class CommitsController < ApplicationController | ||
| 64 | @commit.to_patch, | 64 | @commit.to_patch, |
| 65 | type: "text/plain", | 65 | type: "text/plain", |
| 66 | disposition: 'attachment', | 66 | disposition: 'attachment', |
| 67 | - filename: (@commit.id.to_s + ".patch") | 67 | + filename: "#{@commit.id.patch}" |
| 68 | ) | 68 | ) |
| 69 | end | 69 | end |
| 70 | 70 | ||
| 71 | protected | 71 | protected |
| 72 | 72 | ||
| 73 | def load_refs | 73 | def load_refs |
| 74 | - if params[:ref].blank? | ||
| 75 | - @branch = params[:branch].blank? ? nil : params[:branch] | ||
| 76 | - @tag = params[:tag].blank? ? nil : params[:tag] | ||
| 77 | - @ref = @branch || @tag || @project.try(:default_branch) || 'master' | ||
| 78 | - else | ||
| 79 | - @ref = params[:ref] | ||
| 80 | - end | 74 | + @ref ||= params[:ref].presence || params[:branch].presence || params[:tag].presence |
| 75 | + @ref ||= @ref || @project.try(:default_branch) || 'master' | ||
| 81 | end | 76 | end |
| 82 | end | 77 | end |