Sha256: cb155915482e4ee33d43bea3b3c3d25eb6bc4fd9c70d9c8b073c537662d40bb2

Contents?: true

Size: 633 Bytes

Versions: 1

Compression:

Stored size: 633 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 current_sha
    `git rev-parse HEAD`.chomp
  end

  def fast_forward_merge?(root, branch)
    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

1 entries across 1 versions & 1 rubygems

Version Path
bard-0.23.0 lib/bard/git.rb