Sha256: c3a3aa57044c43b9e6ea6ebd289660244380c700c57d444bbce9a04d88c30186
Contents?: true
Size: 1.67 KB
Versions: 2
Compression:
Stored size: 1.67 KB
Contents
module BardGit private def ensure_integration_branch! return if `git name-rev --name-only HEAD`.chomp == "integration" fatal "You are not on the integration branch! Type `git checkout integration` to switch to it. If you have made changes to your current branch, please see Micah for assistance." end def ensure_clean_working_directory! return if`git status`.include? "working directory clean" fatal "Cannot upload changes: You have uncommitted changes!\n Please run git commit before attempting to push or pull." 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 def submodule_dirty? @repo ||= Grit::Repo.new "." submodules = Grit::Submodule.config(@repo, @repo.head.name) submodules.any? do |name, submodule| Dir.chdir submodule["path"] do not `git status`.include? "working directory clean" end end end def submodule_unpushed? @repo ||= Grit::Repo.new "." submodules = Grit::Submodule.config(@repo, @repo.head.name) submodules.any? do |name, submodule| Dir.chdir submodule["path"] do branch = `git name-rev --name-only HEAD`.chomp `git fetch origin` submodule["id"] != `git rev-parse origin/#{branch}`.chomp end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bard-0.6.1 | lib/bard/git.rb |
bard-0.6.0 | lib/bard/git.rb |