Class: ReaPack::Index::Git::Commit
- Inherits:
-
Object
- Object
- ReaPack::Index::Git::Commit
- Defined in:
- lib/reapack/index/git.rb
Instance Method Summary collapse
- #==(o) ⇒ Object (also: #eql?)
- #each_diff(&block) ⇒ Object
- #filelist ⇒ Object
- #hash ⇒ Object
- #id ⇒ Object
-
#initialize(commit, repo) ⇒ Commit
constructor
A new instance of Commit.
- #inspect ⇒ Object
- #message ⇒ Object
- #short_id ⇒ Object
- #summary ⇒ Object
- #time ⇒ Object
Constructor Details
#initialize(commit, repo) ⇒ Commit
Returns a new instance of Commit.
135 136 137 138 |
# File 'lib/reapack/index/git.rb', line 135 def initialize(commit, repo) @commit, @repo = commit, repo @parent = commit.parents.first end |
Instance Method Details
#==(o) ⇒ Object Also known as: eql?
177 178 179 |
# File 'lib/reapack/index/git.rb', line 177 def ==(o) o && id == o.id end |
#each_diff(&block) ⇒ Object
140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/reapack/index/git.rb', line 140 def each_diff(&block) return @diffs.each &block if @diffs if @parent diff = @parent.diff id else diff = @commit.diff end @diffs = diff.each_delta.map {|delta| Git::Diff.new(delta, @repo) } @diffs.each &block end |
#filelist ⇒ Object
173 174 175 |
# File 'lib/reapack/index/git.rb', line 173 def filelist lsfiles @commit.tree end |
#hash ⇒ Object
183 184 185 |
# File 'lib/reapack/index/git.rb', line 183 def hash id.hash end |
#id ⇒ Object
153 154 155 |
# File 'lib/reapack/index/git.rb', line 153 def id @commit.oid end |
#inspect ⇒ Object
187 188 189 |
# File 'lib/reapack/index/git.rb', line 187 def inspect "#<#{self.class} #{id} #{summary}>" end |
#message ⇒ Object
161 162 163 |
# File 'lib/reapack/index/git.rb', line 161 def @commit. end |
#short_id ⇒ Object
157 158 159 |
# File 'lib/reapack/index/git.rb', line 157 def short_id id[0...7] end |
#summary ⇒ Object
165 166 167 |
# File 'lib/reapack/index/git.rb', line 165 def summary @commit.summary end |
#time ⇒ Object
169 170 171 |
# File 'lib/reapack/index/git.rb', line 169 def time @commit.time end |