Class: Avm::Git::Commit
- Inherits:
-
Object
- Object
- Avm::Git::Commit
- Defined in:
- lib/avm/git/commit.rb,
lib/avm/git/commit/file.rb,
lib/avm/git/commit/class_methods.rb,
lib/avm/git/commit/diff_tree_line.rb
Defined Under Namespace
Modules: ClassMethods Classes: DiffTreeLine, File
Constant Summary collapse
- FIELDS =
{ author_name: '%an', author_email: '%ae', author_date: '%ai', subject: '%s', author_all: '%an <%ae>, %ai', commiter_name: '%cn', commiter_email: '%ce', commiter_date: '%ci', commiter_all: '%cn <%ce>, %ci' }.freeze
Instance Attribute Summary collapse
-
#git ⇒ Object
readonly
Returns the value of attribute git.
-
#sha1 ⇒ Object
readonly
Returns the value of attribute sha1.
Instance Method Summary collapse
- #files_size_uncached ⇒ Object
- #files_uncached ⇒ Object
- #format(format) ⇒ Object
-
#initialize(git, sha1) ⇒ Commit
constructor
A new instance of Commit.
- #root_child? ⇒ Boolean
Constructor Details
#initialize(git, sha1) ⇒ Commit
Returns a new instance of Commit.
22 23 24 25 |
# File 'lib/avm/git/commit.rb', line 22 def initialize(git, sha1) @git = git @sha1 = sha1 end |
Instance Attribute Details
#git ⇒ Object (readonly)
Returns the value of attribute git.
19 20 21 |
# File 'lib/avm/git/commit.rb', line 19 def git @git end |
#sha1 ⇒ Object (readonly)
Returns the value of attribute sha1.
19 20 21 |
# File 'lib/avm/git/commit.rb', line 19 def sha1 @sha1 end |
Instance Method Details
#files_size_uncached ⇒ Object
41 42 43 |
# File 'lib/avm/git/commit.rb', line 41 def files_size_uncached files.inject(0) { |a, e| a + e.dst_size } end |
#files_uncached ⇒ Object
37 38 39 |
# File 'lib/avm/git/commit.rb', line 37 def files_uncached diff_tree_execute.each_line.map { |line| ::Avm::Git::Commit::File.new(git, line) } end |
#format(format) ⇒ Object
27 28 29 |
# File 'lib/avm/git/commit.rb', line 27 def format(format) git.command('--no-pager', 'log', '-1', "--pretty=format:#{format}", sha1).execute!.strip end |
#root_child? ⇒ Boolean
45 46 47 |
# File 'lib/avm/git/commit.rb', line 45 def root_child? format('%P').blank? end |