lib/git/lib.rb in git-ce-1.5.0.1 vs lib/git/lib.rb in git-ce-1.5.0.2
- old
+ new
@@ -74,11 +74,17 @@
arr_opts << repository
arr_opts << clone_dir
command('clone', arr_opts)
- (opts[:bare] or opts[:mirror]) ? {:repository => clone_dir} : {:working_directory => clone_dir}
+ return_opts = if (opts[:bare] or opts[:mirror])
+ {:repository => clone_dir}
+ else
+ {:working_directory => clone_dir}
+ end
+ return_opts[:log] = opts[:log] if opts.key?(:log)
+ return_opts
end
## READ COMMANDS ##
@@ -409,14 +415,14 @@
hsh[file] = {:path => file, :mode_index => mode, :sha_index => sha, :stage => stage}
end
hsh
end
- def ls_remote(location=nil)
+ def ls_remote(location = nil, ref = nil)
location ||= '.'
Hash.new{ |h,k| h[k] = {} }.tap do |hsh|
- command_lines('ls-remote', [location], false).each do |line|
+ command_lines('ls-remote', [location, ref].compact, false).each do |line|
(sha, info) = line.split("\t")
(ref, type, name) = info.split('/', 3)
type ||= 'head'
type = 'branches' if type == 'heads'
value = {:ref => ref, :sha => sha}
@@ -664,11 +670,18 @@
arr_opts << '-m' << message if message
arr_opts += [branch]
command('merge', arr_opts)
end
- def rebase(branch)
- command('rebase', [branch])
+ def rebase(branch, opts = {})
+ arr_opts = []
+ arr_opts << branch
+ if opts[:strategy_option]
+ arr_opts << '--merge'
+ arr_opts << '--strategy-option' << opts[:strategy_option]
+ end
+
+ command('rebase', arr_opts)
end
def unmerged
unmerged = []
command_lines('diff', ["--cached"]).each do |line|