class SimpleGit::Diff

Attributes

ptr[RW]

Private Class Methods

finalize(ptr) click to toggle source
# File lib/simple_git/diff.rb, line 25
def self.finalize(ptr)
  proc { Git2.git_diff_free(ptr) }
end

Public Instance Methods

from_trees(repo, old_tree, new_tree, options) click to toggle source
# File lib/simple_git/diff.rb, line 5
def from_trees(repo, old_tree, new_tree, options)
  wrapper = DiffWrapper.new
  ret = Git2.git_diff_tree_to_tree(wrapper, repo.ptr, old_tree.ptr, new_tree.ptr, options.ptr)
  if ret != 0
    error = Git2::GitError.new(Git2.giterr_last)
    raise ArgumentError, error[:message].read_string
  end

  @ptr = wrapper[:diff]
  ObjectSpace.define_finalizer(self, self.class.finalize(@ptr))

  self
end
stats() click to toggle source
# File lib/simple_git/diff.rb, line 19
def stats
  @stats ||= DiffStat.new(self)
end