Reset to remote HEAD when updating git clones

Git checkouts that do not specify a branch should always reset to the
remote's HEAD, as some remotes have HEAD set to 'unstable' or some other
non-master branch.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
Jack Nagel 2011-11-26 11:33:55 -06:00
parent f017f2d2f5
commit e0441fc26a

View File

@ -366,8 +366,8 @@ class GitDownloadStrategy < AbstractDownloadStrategy
else else
# otherwise the checkout-index won't checkout HEAD # otherwise the checkout-index won't checkout HEAD
# https://github.com/mxcl/homebrew/issues/7124 # https://github.com/mxcl/homebrew/issues/7124
# must specify origin/master, otherwise it resets to the current local HEAD # must specify origin/HEAD, otherwise it resets to the current local HEAD
quiet_safe_system "git", "reset", "--hard", "origin/master" quiet_safe_system "git", "reset", "--hard", "origin/HEAD"
end end
# http://stackoverflow.com/questions/160608/how-to-do-a-git-export-like-svn-export # http://stackoverflow.com/questions/160608/how-to-do-a-git-export-like-svn-export
safe_system 'git', 'checkout-index', '-a', '-f', "--prefix=#{dst}/" safe_system 'git', 'checkout-index', '-a', '-f', "--prefix=#{dst}/"