aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/download_strategy.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index 767a26d15..083031e06 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -257,6 +257,17 @@ class GitDownloadStrategy <AbstractDownloadStrategy
unless system "/usr/bin/which git"
ohai "Cloning #{@url}"
+
+ if @clone.exist?
+ Dir.chdir(@clone) do
+ # Check for interupted clone from a previous install
+ unless system 'git', 'status', '-s'
+ ohai "Removing invalid .git repo from cache"
+ FileUtils.rm_rf @clone
+ end
+ end
+ end
+
unless @clone.exist?
safe_system 'git', 'clone', @url, @clone # indeed, leave it verbose
else