From b81ee9305f418209ba0d77fbb7b47b23d4b121ca Mon Sep 17 00:00:00 2001 From: scott Chacon Date: Sun, 11 Nov 2007 14:37:05 -0800 Subject: added merging functions --- lib/git/lib.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lib/git/lib.rb') diff --git a/lib/git/lib.rb b/lib/git/lib.rb index 41b3efb..9b3922e 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -257,6 +257,14 @@ module Git command('checkout', arr_opts) end + def merge(branch, message = nil) + arr_opts = [] + arr_opts << ["-m '#{message}'"] if message + arr_opts << branch.to_a.join(' ') + command('merge', arr_opts) + end + + private def command_lines(cmd, opts = {}) @@ -278,7 +286,10 @@ module Git #puts "git #{cmd} #{opts}" #puts out #puts - if $?.exitstatus > 1 + if $?.exitstatus > 0 + if $?.exitstatus == 1 && out == '' + return '' + end raise Git::GitExecuteError.new(out) end out -- cgit