diff options
author | Stan Hu <stanhu@gmail.com> | 2019-03-06 21:36:28 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-03-07 15:29:57 +0300 |
commit | 28883d8e449acc6cb8ad6f0312d77a8ee5027e75 (patch) | |
tree | bb7ba6655708dbdb053530cc2a8f79e26d5faef3 /app/helpers/tree_helper.rb | |
parent | 2c4cb7a6a851d0c49077518a5dd0c289526a66e6 (diff) |
Remove old code in TreeHelper#flatten_tree
Diffstat (limited to 'app/helpers/tree_helper.rb')
-rw-r--r-- | app/helpers/tree_helper.rb | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb index e2879bfdcf1..c5bab877c00 100644 --- a/app/helpers/tree_helper.rb +++ b/app/helpers/tree_helper.rb @@ -136,18 +136,9 @@ module TreeHelper end # returns the relative path of the first subdir that doesn't have only one directory descendant - # rubocop: disable CodeReuse/ActiveRecord def flatten_tree(root_path, tree) - return tree.flat_path.sub(%r{\A#{Regexp.escape(root_path)}/}, '') if tree.flat_path.present? - - subtree = Gitlab::Git::Tree.where(@repository, @commit.id, tree.path) - if subtree.count == 1 && subtree.first.dir? - return tree_join(tree.name, flatten_tree(root_path, subtree.first)) - else - return tree.name - end + tree.flat_path.sub(%r{\A#{Regexp.escape(root_path)}/}, '') end - # rubocop: enable CodeReuse/ActiveRecord def selected_branch @branch_name || tree_edit_branch |