Commit 47ec0697 authored by John Budorick's avatar John Budorick Committed by Commit Bot

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: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
parent b3aca437
......@@ -13,11 +13,11 @@ import logging
import optparse
import os
import re
import subprocess
import sys
import tempfile
import threading
import time
import subprocess
import sys
try:
import urlparse
......@@ -495,6 +495,11 @@ class Mirror(object):
# Re-bootstrapping an existing mirror; preserve existing fetch spec.
self._preserve_fetchspec()
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)
bootstrapped = (not depth and bootstrap and
......@@ -864,4 +869,4 @@ if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))
except KeyboardInterrupt:
sys.stderr.write('interrupted\n')
sys.exit(1)
\ No newline at end of file
sys.exit(1)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment