Class: Gitlab::Git::DiffTree
- Inherits:
-
Object
- Object
- Gitlab::Git::DiffTree
- Defined in:
- lib/gitlab/git/diff_tree.rb
Overview
Represents a tree-ish object for git diff-tree command See: git-scm.com/docs/git-diff-tree
Instance Attribute Summary collapse
-
#left_tree_id ⇒ Object
readonly
Returns the value of attribute left_tree_id.
-
#right_tree_id ⇒ Object
readonly
Returns the value of attribute right_tree_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(left_tree_id, right_tree_id) ⇒ DiffTree
constructor
A new instance of DiffTree.
Constructor Details
#initialize(left_tree_id, right_tree_id) ⇒ DiffTree
Returns a new instance of DiffTree.
10 11 12 13 |
# File 'lib/gitlab/git/diff_tree.rb', line 10 def initialize(left_tree_id, right_tree_id) @left_tree_id = left_tree_id @right_tree_id = right_tree_id end |
Instance Attribute Details
#left_tree_id ⇒ Object (readonly)
Returns the value of attribute left_tree_id.
8 9 10 |
# File 'lib/gitlab/git/diff_tree.rb', line 8 def left_tree_id @left_tree_id end |
#right_tree_id ⇒ Object (readonly)
Returns the value of attribute right_tree_id.
8 9 10 |
# File 'lib/gitlab/git/diff_tree.rb', line 8 def right_tree_id @right_tree_id end |
Class Method Details
.from_commit(commit) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/gitlab/git/diff_tree.rb', line 15 def self.from_commit(commit) return unless commit.tree_id parent_tree_id = if commit.parent_ids.blank? Gitlab::Git::EMPTY_TREE_ID else parent_id = commit.parent_ids.first commit.repository.commit(parent_id).tree_id end new(parent_tree_id, commit.tree_id) end |