GitDownloadStrategy: factor out checkout args

This commit is contained in:
Jack Nagel 2013-02-17 15:43:16 -06:00
parent 612745352d
commit 145647fc45

View File

@ -411,15 +411,19 @@ class GitDownloadStrategy < AbstractDownloadStrategy
@clone.cd { update_submodules } if submodules?
end
def checkout
def checkout_args
ref = case @spec
when :branch, :tag, :revision then @ref
else `git symbolic-ref refs/remotes/origin/HEAD`.strip.split("/").last
end
nostdout do
quiet_safe_system @@git, 'checkout', { :quiet_flag => '-q' }, ref, '--'
args = %w{checkout}
args << { :quiet_flag => '-q' }
args << ref
end
def checkout
nostdout { quiet_safe_system @@git, *checkout_args }
end
def update_submodules