Skip to content

Added mirror functionality for creating caches. #145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/git/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {})
Expand Down
15 changes: 13 additions & 2 deletions lib/git/lib.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,15 @@ 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
arr_opts << clone_dir

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


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/git/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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