2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
module BranchesHelper
|
2016-06-16 23:09:34 +05:30
|
|
|
def project_branches
|
|
|
|
options_for_select(@project.repository.branch_names, @project.default_branch)
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
def protected_branch?(project, branch)
|
|
|
|
ProtectedBranch.protected?(project, branch.name)
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
def diverging_count_label(count)
|
|
|
|
if count >= Repository::MAX_DIVERGING_COUNT
|
|
|
|
"#{Repository::MAX_DIVERGING_COUNT - 1}+"
|
|
|
|
else
|
|
|
|
count.to_s
|
|
|
|
end
|
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|