Class: Gollum::Git::Commit

Inherits:
Object
  • Object
show all
Defined in:
lib/rugged_adapter/git_layer_rugged.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(commit, tracked_pathname = nil) ⇒ Commit

Returns a new instance of Commit.



97
98
99
100
# File 'lib/rugged_adapter/git_layer_rugged.rb', line 97

def initialize(commit, tracked_pathname = nil)
  @commit = commit
  @tracked_pathname = tracked_pathname
end

Instance Attribute Details

#commitObject (readonly)

Returns the value of attribute commit.



108
109
110
# File 'lib/rugged_adapter/git_layer_rugged.rb', line 108

def commit
  @commit
end

#tracked_pathnameObject (readonly)

Returns the value of attribute tracked_pathname.



108
109
110
# File 'lib/rugged_adapter/git_layer_rugged.rb', line 108

def tracked_pathname
  @tracked_pathname
end

Instance Method Details

#authorObject



110
111
112
# File 'lib/rugged_adapter/git_layer_rugged.rb', line 110

def author
  @author ||= Gollum::Git::Actor.new(@commit.author[:name], @commit.author[:email])
end

#authored_dateObject



114
115
116
# File 'lib/rugged_adapter/git_layer_rugged.rb', line 114

def authored_date
  @commit.author[:time]
end

#idObject Also known as: sha, to_s



102
103
104
# File 'lib/rugged_adapter/git_layer_rugged.rb', line 102

def id
  @commit.oid
end

#messageObject



118
119
120
# File 'lib/rugged_adapter/git_layer_rugged.rb', line 118

def message
  @commit.message
end

#parentObject



130
131
132
# File 'lib/rugged_adapter/git_layer_rugged.rb', line 130

def parent
  @commit.parents.empty? ? nil : Gollum::Git::Commit.new(@commit.parents.first)
end

#statsObject



126
127
128
# File 'lib/rugged_adapter/git_layer_rugged.rb', line 126

def stats
  @stats ||= build_stats
end

#treeObject



122
123
124
# File 'lib/rugged_adapter/git_layer_rugged.rb', line 122

def tree
  Gollum::Git::Tree.new(@commit.tree)
end