From 1f5a39b977dfb365372aab5cc832e681c9eb244c Mon Sep 17 00:00:00 2001 From: Max Howell Date: Fri, 26 Aug 2011 15:06:24 +0100 Subject: `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.--- Library/Homebrew/download_strategy.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Library') 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}/" -- cgit v1.2.3