summaryrefslogtreecommitdiff
path: root/app/controllers/projects_controller.rb
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-06-16 12:53:58 +0100
committerPhil Hughes <me@iamphill.com>2016-06-18 21:49:20 +0100
commit68c9981013b1aa87dde7421ffe5db0a342d55ee8 (patch)
tree147a9af9a77e0606649923c5a1e421989aca8b45 /app/controllers/projects_controller.rb
parent3c8c9129654d49281024bfb444d95e5d7c35bcbd (diff)
downloadgitlab-ce-68c9981013b1aa87dde7421ffe5db0a342d55ee8.tar.gz
Correctly adds commit ID into dropdown
Removes un-used method Fixes other Ruby issues
Diffstat (limited to 'app/controllers/projects_controller.rb')
-rw-r--r--app/controllers/projects_controller.rb14
1 files changed, 6 insertions, 8 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 5155ae1b104..e2311971f70 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -252,20 +252,18 @@ class ProjectsController < Projects::ApplicationController
end
def refs
- repository = @project.repository
- tags = VersionSorter.rsort(repository.tag_names)
-
options = {
- 'Branches' => repository.branch_names,
+ 'Branches' => @repository.branch_names,
}
- if tags.any?
- options['Tags'] = tags
+ unless @repository.tag_count.zero?
+ options['Tags'] = VersionSorter.rsort(@repository.tag_names)
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
+ ref = params[:ref]
+ if ref && !options.flatten.include?(ref) && ref =~ /\A[0-9a-zA-Z]{6,52}\z/
+ options['Commits'] = [ref]
end
render json: options.to_json