aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2011-09-13 22:19:50 -0500
committerJack Nagel2011-09-13 22:26:36 -0500
commitd95e7079a2f0c6e259dcf8e1222dcb80da250fcb (patch)
tree0c139eff04504ef6d0e5c450327d38effc447015 /Library
parent555b9d149f862bf687481816349e2c9739c1220b (diff)
downloadbrew-d95e7079a2f0c6e259dcf8e1222dcb80da250fcb.tar.bz2
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: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/download_strategy.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index cfdaaa7be..d043ef450 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -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}/"