Pulls back tags if any exist
This commit is contained in:
parent
ed0f26c223
commit
3c8c912965
1 changed files with 6 additions and 2 deletions
|
@ -253,15 +253,19 @@ class ProjectsController < Projects::ApplicationController
|
||||||
|
|
||||||
def refs
|
def refs
|
||||||
repository = @project.repository
|
repository = @project.repository
|
||||||
|
tags = VersionSorter.rsort(repository.tag_names)
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
'Branches' => repository.branch_names,
|
'Branches' => repository.branch_names,
|
||||||
'Tags' => VersionSorter.rsort(repository.tag_names)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if tags.any?
|
||||||
|
options['Tags'] = tags
|
||||||
|
end
|
||||||
|
|
||||||
# If reference is commit id - we should add it to branch/tag selectbox
|
# If reference is commit id - we should add it to branch/tag selectbox
|
||||||
if @ref && !options.flatten.include?(@ref) && @ref =~ /\A[0-9a-zA-Z]{6,52}\z/
|
if @ref && !options.flatten.include?(@ref) && @ref =~ /\A[0-9a-zA-Z]{6,52}\z/
|
||||||
options << { 'Commits' => @ref }
|
options['Commits'] = @ref
|
||||||
end
|
end
|
||||||
|
|
||||||
render json: options.to_json
|
render json: options.to_json
|
||||||
|
|
Loading…
Reference in a new issue