Skip to content
Snippets Groups Projects
Commit d95e7079 authored by Jack Nagel's avatar Jack Nagel
Browse files

Reset to remote master when updating git clones


When installing with --HEAD, cached repo clones do "git fetch origin"
followed by "git reset --hard". This will only reset the working tree
and index to the state of the local HEAD, but Homebrew will think it's
updated and install anyway. "git reset --hard origin/master" will
achieve the desired result.

Should fix Homebrew/homebrew#7613.

Signed-off-by: default avatarJack Nagel <jacknagel@gmail.com>
parent 555b9d14
No related branches found
No related tags found
No related merge requests found
......@@ -346,7 +346,8 @@ class GitDownloadStrategy < AbstractDownloadStrategy
else
# otherwise the checkout-index won't checkout HEAD
# https://github.com/mxcl/homebrew/issues/7124
quiet_safe_system "git", "reset", "--hard"
# must specify origin/master, otherwise it resets to the current local HEAD
quiet_safe_system "git", "reset", "--hard", "origin/master"
end
# http://stackoverflow.com/questions/160608/how-to-do-a-git-export-like-svn-export
safe_system 'git', 'checkout-index', '-a', '-f', "--prefix=#{dst}/"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment