module GitHelpersMixin
Public Instance Methods
branchExists?(branch, remote = nil)
click to toggle source
# File lib/git_bpf/lib/git-helpers.rb, line 86 def branchExists?(branch, remote = nil) if remote ref = "refs/remotes/#{remote}/#{branch}" else ref = (branch.include? "refs/heads/") ? branch : "refs/heads/#{branch}" end begin git('show-ref', '--verify', '--quiet', ref) rescue return false end return true end
context(work_tree, git_dir, *args)
click to toggle source
# File lib/git_bpf/lib/git-helpers.rb, line 76 def context(work_tree, git_dir, *args) # Git pull requires absolute paths when executed from outside of the # repository's work tree. params = [ "--git-dir=#{File.expand_path(git_dir)}", "--work-tree=#{File.expand_path(work_tree)}" ] return params + args end
promptYN(message)
click to toggle source
# File lib/git_bpf/lib/git-helpers.rb, line 114 def promptYN(message) puts puts "#{message} [y/N]" unless STDIN.gets.chomp == 'y' return false end return true end
refExists?(ref)
click to toggle source
# File lib/git_bpf/lib/git-helpers.rb, line 100 def refExists?(ref) begin git('show-ref', '--tags', '--heads', ref) rescue return false end return true end
terminate(message = nil)
click to toggle source
# File lib/git_bpf/lib/git-helpers.rb, line 109 def terminate(message = nil) puts message if message != nil throw :exit end