Class: Gollum::Git::Commit
- Inherits:
-
Object
- Object
- Gollum::Git::Commit
- Defined in:
- lib/rjgit_adapter/git_layer_rjgit.rb
Instance Attribute Summary collapse
-
#commit ⇒ Object
readonly
Returns the value of attribute commit.
Instance Method Summary collapse
- #author ⇒ Object
- #authored_date ⇒ Object
- #id ⇒ Object (also: #sha, #to_s)
-
#initialize(commit) ⇒ Commit
constructor
A new instance of Commit.
- #message ⇒ Object
- #parent ⇒ Object
- #stats ⇒ Object
- #tracked_pathname ⇒ Object
- #tree ⇒ Object
Constructor Details
#initialize(commit) ⇒ Commit
Returns a new instance of Commit.
108 109 110 |
# File 'lib/rjgit_adapter/git_layer_rjgit.rb', line 108 def initialize(commit) @commit = commit end |
Instance Attribute Details
#commit ⇒ Object (readonly)
Returns the value of attribute commit.
106 107 108 |
# File 'lib/rjgit_adapter/git_layer_rjgit.rb', line 106 def commit @commit end |
Instance Method Details
#author ⇒ Object
118 119 120 121 |
# File 'lib/rjgit_adapter/git_layer_rjgit.rb', line 118 def = @commit.actor Gollum::Git::Actor.new(.name, .email) end |
#authored_date ⇒ Object
123 124 125 |
# File 'lib/rjgit_adapter/git_layer_rjgit.rb', line 123 def @commit. end |
#id ⇒ Object Also known as: sha, to_s
112 113 114 |
# File 'lib/rjgit_adapter/git_layer_rjgit.rb', line 112 def id @commit.id end |
#message ⇒ Object
127 128 129 |
# File 'lib/rjgit_adapter/git_layer_rjgit.rb', line 127 def @commit. end |
#parent ⇒ Object
135 136 137 |
# File 'lib/rjgit_adapter/git_layer_rjgit.rb', line 135 def parent @commit.parents.empty? ? nil : Gollum::Git::Commit.new(@commit.parents.first) end |
#stats ⇒ Object
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/rjgit_adapter/git_layer_rjgit.rb', line 139 def stats return @stats unless @stats.nil? rjgit_stats = @commit.stats files = rjgit_stats[:files].map do |file| file[:new_file] == file[:old_file] if file[:new_file] == '/dev/null' # File is deleted, display only the original, deleted path. file.delete(:old_file) if (file[:old_file] == '/dev/null') || (file[:old_file] == file[:new_file]) # Don't include an old path when the file is new, or it's a regular update file end @stats = OpenStruct.new( :additions => rjgit_stats[:total_additions], :deletions => rjgit_stats[:total_deletions], :total => rjgit_stats[:total_additions] + rjgit_stats[:total_deletions], :files => files, :id => id ) end |
#tracked_pathname ⇒ Object
158 159 160 161 162 163 164 |
# File 'lib/rjgit_adapter/git_layer_rjgit.rb', line 158 def tracked_pathname begin @commit.tracked_pathname rescue NoMethodError nil end end |