Fix branch_or_tag parse constraint, minor refactor. Refs #263
This commit is contained in:
parent
dc95d6c13a
commit
33d722b779
|
@ -24,7 +24,7 @@ module Rosa
|
|||
if (params = request.path_parameters) && params[:treeish] # parse existing branch (tag) and path
|
||||
branch_or_tag = begin
|
||||
(p = Project.find_by_owner_and_name params[:owner_name], params[:project_name]) &&
|
||||
p.repo.branches_and_tags.detect{|t| params[:treeish].start_with?(t.name)}.try(:name) ||
|
||||
p.repo.branches_and_tags.map(&:name).sort{|a,b| b.length <=> a.length}.detect{|b| params[:treeish].start_with?(b)} ||
|
||||
params[:treeish].split('/').first
|
||||
end
|
||||
if path = params[:treeish].sub(branch_or_tag, '')[1..-1] and path.present?
|
||||
|
|
Loading…
Reference in New Issue