Sha256: 3c15e33f4781a8125f1a4ff713ed591bee2c9e54b38c317affc4a48027b4e273
Contents?: true
Size: 1.08 KB
Versions: 10
Compression:
Stored size: 1.08 KB
Contents
module Gitlab module Git class Tree attr_accessor :repository, :sha, :path, :ref, :raw_tree, :id def initialize(repository, sha, ref = nil, path = nil) @repository, @sha, @ref, @path = repository, sha, ref, path @path = nil if !@path || @path == '' # Load tree from repository @commit = Gitlab::Git::Commit.find(@repository, @sha) @raw_tree = @repository.tree(@commit, @path) end def exists? raw_tree end def empty? trees.empty? && blobs.empty? end def trees entries.select { |t| t.is_a?(Grit::Tree) } end def blobs entries.select { |t| t.is_a?(Grit::Blob) } end def submodules entries.select { |t| t.is_a?(Grit::Submodule) } end def is_blob? raw_tree.is_a?(Grit::Blob) end def up_dir? path && path != '' end def readme @readme ||= blobs.find { |c| c.name =~ /^readme/i } end protected def entries raw_tree.contents end end end end
Version data entries
10 entries across 10 versions & 1 rubygems