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.
20 21 22 23 |
# File 'lib/avm/git/commit.rb', line 20 def initialize(git, sha1) @git = git @sha1 = sha1 end |
Instance Attribute Details
#git ⇒ Object (readonly)
Returns the value of attribute git.
17 18 19 |
# File 'lib/avm/git/commit.rb', line 17 def git @git end |
#sha1 ⇒ Object (readonly)
Returns the value of attribute sha1.
17 18 19 |
# File 'lib/avm/git/commit.rb', line 17 def sha1 @sha1 end |
Instance Method Details
#files_size_uncached ⇒ Object
39 40 41 |
# File 'lib/avm/git/commit.rb', line 39 def files_size_uncached files.inject(0) { |a, e| a + e.dst_size } end |
#files_uncached ⇒ Object
35 36 37 |
# File 'lib/avm/git/commit.rb', line 35 def files_uncached diff_tree_execute.each_line.map { |line| ::Avm::Git::Commit::File.new(git, line) } end |
#format(format) ⇒ Object
25 26 27 |
# File 'lib/avm/git/commit.rb', line 25 def format(format) git.command('--no-pager', 'log', '-1', "--pretty=format:#{format}", sha1).execute!.strip end |
#root_child? ⇒ Boolean
43 44 45 |
# File 'lib/avm/git/commit.rb', line 43 def root_child? format('%P').blank? # rubocop:disable Style/RedundantFormat end |