Sha256: ed4e693353e4fa2abff84051f3dd62aabbebd36c7e04e3e034ee90b67565ccd2

Contents?: true

Size: 644 Bytes

Versions: 5

Compression:

Stored size: 644 Bytes

Contents

module Bard::CLI::Git
  private

  def current_branch
    ref = `git symbolic-ref HEAD 2>&1`.chomp
    return false if ref =~ /^fatal:/
    ref.sub(/refs\/heads\//, '') # refs/heads/master ... we want "master"
  end

  def fast_forward_merge?(root = "origin/integration", branch = "HEAD")
    run_crucial "git fetch origin"
    root_head = run_crucial "git rev-parse #{root}"
    branch_head = run_crucial "git rev-parse #{branch}"
    @common_ancestor = find_common_ancestor root_head, branch_head 
    @common_ancestor == root_head
  end

  def find_common_ancestor(head1, head2)
    run_crucial "git merge-base #{head1} #{head2}"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bard-0.22.2 lib/bard/git.rb
bard-0.22.1 lib/bard/git.rb
bard-0.22.0 lib/bard/git.rb
bard-0.21.0 lib/bard/git.rb
bard-0.20.0 lib/bard/git.rb