class Rugged::Commit

Public Class Methods

prettify_message(msg, strip_comments = true) click to toggle source
# File lib/rugged/commit.rb, line 4
def self.prettify_message(msg, strip_comments = true)
  Rugged::prettify_message(msg, strip_comments)
end

Public Instance Methods

diff(*args) click to toggle source

Return a diff between this commit and its first parent or another commit or tree.

See Rugged::Tree#diff for more details.

# File lib/rugged/commit.rb, line 15
def diff(*args)
  args.unshift(parents.first) if args.size == 1 && args.first.is_a?(Hash)
  self.tree.diff(*args)
end
diff_workdir(options = {}) click to toggle source

Return a diff between this commit and the workdir.

See Rugged::Tree#diff_workdir for more details.

# File lib/rugged/commit.rb, line 23
def diff_workdir(options = {})
  self.tree.diff_workdir(options)
end
inspect() click to toggle source
# File lib/rugged/commit.rb, line 8
def inspect
  "#<Rugged::Commit:#{object_id} {message: #{message.inspect}, tree: #{tree.inspect}, parents: #{parent_oids}}>"
end
modify(new_args, update_ref=nil) click to toggle source
# File lib/rugged/commit.rb, line 45
def modify(new_args, update_ref=nil)
  args = self.to_hash.merge(new_args)
  Commit.create(args, update_ref)
end
time() click to toggle source

The time when this commit was made effective. This is the same value as the :time attribute for commit.committer.

Returns a Time object

# File lib/rugged/commit.rb, line 31
def time
  @time ||= Time.at(self.epoch_time)
end
to_hash() click to toggle source
# File lib/rugged/commit.rb, line 35
def to_hash
  {
    :message => message,
    :committer => committer,
    :author => author,
    :tree => tree,
    :parents => parents,
  }
end