GitDownloadStrategy: default to remote HEAD during checkout

This commit is contained in:
Jack Nagel 2013-02-14 17:29:59 -06:00
parent 166e262312
commit 2ef79d1387

View File

@ -377,7 +377,7 @@ class GitDownloadStrategy < AbstractDownloadStrategy
end end
def clone_args def clone_args
args = %w{clone --no-checkout} args = %w{clone}
args << '--depth' << '1' if support_depth? args << '--depth' << '1' if support_depth?
case @spec case @spec
@ -408,16 +408,13 @@ class GitDownloadStrategy < AbstractDownloadStrategy
def clone_repo def clone_repo
safe_system @@git, *clone_args safe_system @@git, *clone_args
@clone.cd do @clone.cd { update_submodules } if submodules?
checkout
update_submodules if submodules?
end
end end
def checkout def checkout
ref = case @spec ref = case @spec
when :branch then "origin/#@ref" when :branch, :tag, :revision then @ref
when :tag, :revision then @ref else `git symbolic-ref refs/remotes/origin/HEAD`.strip.split("/").last
end end
nostdout do nostdout do