diff --git a/lib/git/base.rb b/lib/git/base.rb index bcec10e6..c2d5fc02 100644 --- a/lib/git/base.rb +++ b/lib/git/base.rb @@ -52,7 +52,9 @@ def self.init(working_dir, opts = {}) # def self.clone(repository, name, opts = {}) # run git-clone - self.new(Git::Lib.new.clone(repository, name, opts)) + logger = opts[:log] + + self.new(Git::Lib.new(nil, logger).clone(repository, name, opts)) end def initialize(options = {}) diff --git a/lib/git/lib.rb b/lib/git/lib.rb index 975bc148..1f5abce2 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -61,6 +61,7 @@ def clone(repository, name, opts = {}) arr_opts << "-o" << opts[:remote] if opts[:remote] arr_opts << "--depth" << opts[:depth].to_i if opts[:depth] && opts[:depth].to_i > 0 arr_opts << "--config" << opts[:config] if opts[:config] + arr_opts << "--mirror" if opts[:mirror] arr_opts << '--' arr_opts << repository @@ -68,7 +69,7 @@ def clone(repository, name, opts = {}) command('clone', arr_opts) - opts[:bare] ? {:repository => clone_dir} : {:working_directory => clone_dir} + (opts[:bare] or opts[:mirror]) ? {:repository => clone_dir} : {:working_directory => clone_dir} end @@ -226,7 +227,8 @@ def branches_all arr = [] command_lines('branch', '-a').each do |b| current = (b[0, 2] == '* ') - arr << [b.gsub('* ', '').strip, current] + branch = b.gsub('* ', '').strip + arr << [branch, current] unless branch == '(no branch)' end arr end @@ -576,6 +578,15 @@ def remote_remove(name) command('remote', ['rm', name]) end + def remote_update(opts={}) + remotes=opts.delete(:remotes) + arr_opts = ['update'] + arr_opts << '-p' if opts[:prune] + arr_opts.concat remotes if remotes + + command('remote', arr_opts) + end + def remotes command_lines('remote') end diff --git a/lib/git/version.rb b/lib/git/version.rb index cc83c888..7b2b1b44 100644 --- a/lib/git/version.rb +++ b/lib/git/version.rb @@ -2,6 +2,6 @@ module Git # The current gem version # @return [String] the current gem version. - VERSION='1.2.6' + VERSION='1.2.7' end