Class: Git::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/danger/scm_source/git_repo.rb

Instance Method Summary collapse

Instance Method Details

#merge_base(commit1, commit2, *other_commits) ⇒ Object

Use git-merge-base git-scm.com/docs/git-merge-base to find as good common ancestors as possible for a merge



220
221
222
223
224
225
226
227
228
# File 'lib/danger/scm_source/git_repo.rb', line 220

def merge_base(commit1, commit2, *other_commits)
  puts "will git merge-base commit1 #{commit1}, commit2 #{commit2}"
  output = Open3.popen2("git", "merge-base", commit1, commit2, *other_commits) { |_stdin, stdout, _wait_thr| stdout.read.rstrip }
  
  puts "Command output:"
  puts output
  
  output
end