diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-04-02 21:30:36 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-04-02 21:30:36 +0300 |
commit | 5f4445c3d384741c45242f077b3c0dbf76234ee8 (patch) | |
tree | 21962b2905103f2b3a585bda0ba6e60a669cb190 /app/models/tree.rb | |
parent | 7af16bbb0fdce36cf8b7e43e5cd64a712dfdaa1d (diff) | |
download | gitlab-ce-5f4445c3d384741c45242f077b3c0dbf76234ee8.tar.gz |
store commits for MR as array of hashes
Diffstat (limited to 'app/models/tree.rb')
-rw-r--r-- | app/models/tree.rb | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/app/models/tree.rb b/app/models/tree.rb index 4b6c5b133e9..e726c596f7e 100644 --- a/app/models/tree.rb +++ b/app/models/tree.rb @@ -1,37 +1,21 @@ class Tree - include Linguist::BlobHelper - attr_accessor :path, :tree, :ref - delegate :contents, :basename, :name, :data, :mime_type, - :mode, :size, :text?, :colorize, to: :tree - - def initialize(raw_tree, ref = nil, path = nil) - @ref, @path = ref, path - @tree = if path.present? - raw_tree / path - else - raw_tree - end - end - - def is_blob? - tree.is_a?(Grit::Blob) + def initialize(repository, sha, ref = nil, path = nil) + @raw = Gitlab::Git::Tree.new(repository, sha, ref, path) end def invalid? - tree.nil? + @raw.nil? end - def empty? - data.blank? + def method_missing(m, *args, &block) + @raw.send(m, *args, &block) end - def up_dir? - path.present? - end + def respond_to?(method) + return true if @raw.respond_to?(method) - def readme - @readme ||= contents.find { |c| c.is_a?(Grit::Blob) and c.name =~ /^readme/i } + super end end |