Module: Avm::Git::Issue::Complete::Commits

Defined in:
lib/avm/git/issue/complete/commits.rb

Instance Method Summary collapse

Instance Method Details

#bifurcations_resultObject



21
22
23
24
25
26
27
28
# File 'lib/avm/git/issue/complete/commits.rb', line 21

def bifurcations_result
  commits.each do |commit|
    if multiple_parents?(commit)
      return ::Avm::Result.error("#{commit} has multiple parents")
    end
  end
  ::Avm::Result.success('no')
end

#commit_parents(commit) ⇒ Object



34
35
36
37
# File 'lib/avm/git/issue/complete/commits.rb', line 34

def commit_parents(commit)
  launcher_git.execute!('log', '--pretty=%P', '-n', '1', commit).split.map(&:strip)
    .select(&:present?)
end

#commits_resultObject



10
11
12
# File 'lib/avm/git/issue/complete/commits.rb', line 10

def commits_result
  ::Avm::Result.success_or_error(commits.any?, 'yes', 'none')
end

#commits_uncachedObject



14
15
16
17
18
19
# File 'lib/avm/git/issue/complete/commits.rb', line 14

def commits_uncached
  return [] unless branch_hash && follow_master?

  interval = remote_master_hash ? "#{remote_master_hash}..#{branch_hash}" : branch_hash
  launcher_git.execute!('rev-list', interval).each_line.map(&:strip)
end

#multiple_parents?(commit) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/avm/git/issue/complete/commits.rb', line 30

def multiple_parents?(commit)
  commit_parents(commit).count > 1
end