git_cache: remove the mirror_path if it exists in an incomplete state.

Bug: 958286
Change-Id: If8351dfc0790e1db5867c103139a067c651fca3a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1590500
Commit-Queue: John Budorick <jbudorick@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
changes/00/1590500/3
John Budorick 6 years ago committed by Commit Bot
parent b3aca437d0
commit 47ec0697f0

@ -13,11 +13,11 @@ import logging
import optparse import optparse
import os import os
import re import re
import subprocess
import sys
import tempfile import tempfile
import threading import threading
import time import time
import subprocess
import sys
try: try:
import urlparse import urlparse
@ -495,6 +495,11 @@ class Mirror(object):
# Re-bootstrapping an existing mirror; preserve existing fetch spec. # Re-bootstrapping an existing mirror; preserve existing fetch spec.
self._preserve_fetchspec() self._preserve_fetchspec()
else: else:
if os.path.exists(self.mirror_path):
# If the mirror path exists but self.exists() returns false, we're
# in an unexpected state. Nuke the previous mirror directory and
# start fresh.
gclient_utils.rmtree(self.mirror_path)
os.mkdir(self.mirror_path) os.mkdir(self.mirror_path)
bootstrapped = (not depth and bootstrap and bootstrapped = (not depth and bootstrap and

Loading…
Cancel
Save