aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMax Howell2011-08-26 15:06:24 +0100
committerMax Howell2011-08-26 15:06:24 +0100
commit1f5a39b977dfb365372aab5cc832e681c9eb244c (patch)
treebeaa330a5ecbd781e0742bc9dce08f6cc088b05d /Library
parentfd96bb6e3a19f2e049e70111fa5401c9266c59db (diff)
downloadbrew-1f5a39b977dfb365372aab5cc832e681c9eb244c.tar.bz2
`git reset --hard` after fetch; Fixes Homebrew/homebrew#7124
I believe this fixes it though I confess I didn't test. The guy who opened this issue is the expert.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/download_strategy.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index b457fd927..a265e0b35 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -311,7 +311,7 @@ class GitDownloadStrategy < AbstractDownloadStrategy
Dir.chdir(@clone) do
# Check for interupted clone from a previous install
unless system 'git', 'status', '-s'
- ohai "Removing invalid .git repo from cache"
+ puts "Removing invalid .git repo from cache"
FileUtils.rm_rf @clone
end
end
@@ -328,7 +328,6 @@ class GitDownloadStrategy < AbstractDownloadStrategy
Dir.chdir(@clone) do
safe_system 'git', 'remote', 'set-url', 'origin', @url
quiet_safe_system 'git', 'fetch', 'origin'
- # If we're going to checkout a tag, then we need to fetch new tags too.
quiet_safe_system 'git', 'fetch', '--tags' if @spec == :tag
end
end
@@ -345,6 +344,10 @@ class GitDownloadStrategy < AbstractDownloadStrategy
when :tag
nostdout { quiet_safe_system 'git', 'checkout', @ref }
end
+ else
+ # otherwise the checkout-index won't checkout HEAD
+ # https://github.com/mxcl/homebrew/issues/7124
+ quiet_safe_system "git", "reset", "--hard"
end
# http://stackoverflow.com/questions/160608/how-to-do-a-git-export-like-svn-export
safe_system 'git', 'checkout-index', '-a', '-f', "--prefix=#{dst}/"