The GitProxy is responsible to iteract with git repositories. All actions required by the Git source is encapsualted in this object.
# File lib/bundler/source.rb, line 508 def initialize(path, uri, ref, revision=nil, &allow) @path = path @uri = uri @ref = ref @revision = revision @allow = allow || Proc.new { true } end
# File lib/bundler/source.rb, line 520 def branch @branch ||= allowed_in_path do git("branch") =~ %r^\* (.*)$/ && $1.strip end end
# File lib/bundler/source.rb, line 533 def checkout if path.exist? return if has_revision_cached? Bundler.ui.info "Updating #{uri}" in_path do git %Qfetch --force --quiet --tags #{uri_escaped} "refs/heads/*:refs/heads/*"| end else Bundler.ui.info "Fetching #{uri}" FileUtils.mkdir_p(path.dirname) git %Qclone #{uri_escaped} "#{path}" --bare --no-hardlinks| end end
# File lib/bundler/source.rb, line 526 def contains?(commit) allowed_in_path do result = git_null("branch --contains #{commit}") $? == 0 && result =~ %r^\* (.*)$/ end end
# File lib/bundler/source.rb, line 547 def copy_to(destination, submodules=false) unless File.exist?(destination.join(".git")) FileUtils.mkdir_p(destination.dirname) FileUtils.rm_rf(destination) git %Qclone --no-checkout "#{path}" "#{destination}"| File.chmod((0777 & ~File.umask), destination) end Dir.chdir(destination) do git %Qfetch --force --quiet --tags "#{path}"| git "reset --hard #{@revision}" if submodules git "submodule update --init --recursive" end end end