Commit 25c2dd97 authored by Douwe Maan's avatar Douwe Maan Committed by Eric Eastwood

Return nil parent_tree_url for root tree entity

parent e43a6b0e
# TODO: Inherit from TreeEntity, when `Tree` implements `id` and `name` like `Gitlab::Git::Tree`.
class TreeRootEntity < Grape::Entity
include RequestAwareEntity
expose :path
expose :trees, using: TreeEntity
......@@ -9,9 +9,10 @@ class TreeRootEntity < Grape::Entity
expose :submodules, using: SubmoduleEntity
expose :parent_tree_url do |tree|
next unless tree.path.present?
path = tree.path.sub(%r{\A/}, '')
next unless path.present?
path_segments = tree.path.split('/')
path_segments = path.split('/')
path_segments.pop
parent_tree_path = path_segments.join('/')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment