From 90baab7e21e6d1f327f2675dcc5516feffb3729f Mon Sep 17 00:00:00 2001 From: Brett Walker Date: Tue, 17 Oct 2017 13:16:42 +0200 Subject: [PATCH] optimize branching logic --- app/views/projects/commit/branches.html.haml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/views/projects/commit/branches.html.haml b/app/views/projects/commit/branches.html.haml index 933cb2f73ce..31d10ff9040 100644 --- a/app/views/projects/commit/branches.html.haml +++ b/app/views/projects/commit/branches.html.haml @@ -1,9 +1,8 @@ -- if @branches.any? || @branches_limit_exceeded - - if @branches_limit_exceeded - = commit_branch_link('#', _('Too many branches to search')) - - else - - branch = commit_default_branch(@project, @branches) - = commit_branch_link(project_ref_path(@project, branch), branch) +- if @branches_limit_exceeded + = commit_branch_link('#', _('Too many branches to search')) +- elsif @branches.any? + - branch = commit_default_branch(@project, @branches) + = commit_branch_link(project_ref_path(@project, branch), branch) -# `commit_default_branch` deletes the default branch from `@branches`, -# so only render this if we have more branches or tags left