Fix for when a repository fails to clone or pull and purge deletes everything

Fix for #178