Check git repos for validity before updating.
If you `brew install erlang` and then control-C during the git clone, you can leave your cloned repo in an invalid state. This change does a "git status" on the clone if it exists, and nukes it if the status is invalid (forcing a clean clone.)
This commit is contained in:
parent
e750242b73
commit
8a60d852b3
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user