diff options
author | Phil Hughes <me@iamphill.com> | 2016-06-08 13:29:18 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-06-18 21:49:20 +0100 |
commit | 3c8c9129654d49281024bfb444d95e5d7c35bcbd (patch) | |
tree | 3d119143757be2c0b1c52cf64336f82947bc5a05 /app/controllers/projects_controller.rb | |
parent | ed0f26c223b5182fa2cb7a54bfd8ce155948deb2 (diff) | |
download | gitlab-ce-3c8c9129654d49281024bfb444d95e5d7c35bcbd.tar.gz |
Pulls back tags if any exist
Diffstat (limited to 'app/controllers/projects_controller.rb')
-rw-r--r-- | app/controllers/projects_controller.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index aaa4e49eb42..5155ae1b104 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -253,15 +253,19 @@ class ProjectsController < Projects::ApplicationController def refs repository = @project.repository + tags = VersionSorter.rsort(repository.tag_names) options = { '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 @ref && !options.flatten.include?(@ref) && @ref =~ /\A[0-9a-zA-Z]{6,52}\z/ - options << { 'Commits' => @ref } + options['Commits'] = @ref end render json: options.to_json |