Commit d328b416 authored by Douwe Maan's avatar Douwe Maan

Fix tree readme.

parent 6581aea3
class Tree
include Gitlab::MarkdownHelper
attr_accessor :entries
attr_accessor :repository, :sha, :path, :entries
def initialize(repository, sha, path = '/')
path = '/' if path.blank?
git_repo = repository.raw_repository
@entries = Gitlab::Git::Tree.where(git_repo, sha, path)
@repository = repository
@sha = sha
@path = path
git_repo = @repository.raw_repository
@entries = Gitlab::Git::Tree.where(git_repo, @sha, @path)
end
def readme
return @readme if defined?(@readme)
available_readmes = @blobs.select(&:readme?)
available_readmes = blobs.select(&:readme?)
if available_readmes.count == 0
return @readme = nil
......@@ -26,6 +31,7 @@ class Tree
readme_path = path == '/' ? readme_tree.name : File.join(path, readme_tree.name)
git_repo = repository.raw_repository
@readme = Gitlab::Git::Blob.find(git_repo, sha, readme_path)
end
......
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