Sha256: 78251686358c1155770c80beb196652ad68455868b0dd8774de30c6023e4660d
Contents?: true
Size: 995 Bytes
Versions: 4
Compression:
Stored size: 995 Bytes
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 = @repository.commit(@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 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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
gitlab_git-1.0.5 | lib/gitlab_git/tree.rb |
gitlab_git-1.0.4 | lib/gitlab_git/tree.rb |
gitlab_git-1.0.3 | lib/gitlab_git/tree.rb |
gitlab_git-1.0.2 | lib/gitlab_git/tree.rb |