Welcome to mirror list, hosted at ThFree Co, Russian Federation.

tree.rb « models « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6b6b2d40a55f6e72c91637bde2fef6706768acaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class Tree
  include Utils::FileHelper
  attr_accessor :path, :tree, :project, :ref

  delegate :contents,
    :basename,
    :name,
    :data,
    :mime_type,
    :text?,
    :colorize,
    :to => :tree

  def initialize(raw_tree, project, ref = nil, path = nil)
    @project, @ref, @path = project, ref, path,
    @tree = if path
              raw_tree / path
            else
              raw_tree
            end
  end

  def is_blob?
    tree.is_a?(Grit::Blob)
  end

  def empty?
    data.blank?
  end
end