Class: Avm::Git::Commit

Inherits:
Object show all
Defined in:
lib/avm/git/commit.rb,
lib/avm/git/commit/file.rb,
lib/avm/git/commit/deploy.rb,
lib/avm/git/commit/class_methods.rb,
lib/avm/git/commit/deploy_methods.rb,
lib/avm/git/commit/diff_tree_line.rb

Defined Under Namespace

Modules: ClassMethods, DeployMethods Classes: Deploy, 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

Instance Method Summary collapse

Constructor Details

#initialize(git, sha1) ⇒ Commit

Returns a new instance of Commit.



21
22
23
24
# File 'lib/avm/git/commit.rb', line 21

def initialize(git, sha1)
  @git = git
  @sha1 = sha1
end

Instance Attribute Details

#gitObject (readonly)

Returns the value of attribute git.



19
20
21
# File 'lib/avm/git/commit.rb', line 19

def git
  @git
end

#sha1Object (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_uncachedObject



40
41
42
# File 'lib/avm/git/commit.rb', line 40

def files_size_uncached
  files.inject(0) { |a, e| a + e.dst_size }
end

#files_uncachedObject



36
37
38
# File 'lib/avm/git/commit.rb', line 36

def files_uncached
  diff_tree_execute.each_line.map { |line| ::Avm::Git::Commit::File.new(git, line) }
end

#format(format) ⇒ Object



26
27
28
# File 'lib/avm/git/commit.rb', line 26

def format(format)
  git.execute!('--no-pager', 'log', '-1', "--pretty=format:#{format}", sha1).strip
end

#root_child?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/avm/git/commit.rb', line 44

def root_child?
  format('%P').blank?
end