From: Zack Cerza Date: Fri, 6 Jun 2014 17:01:33 +0000 (-0500) Subject: Fix corrupt repo detection X-Git-Tag: 1.1.0~1415 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=87e7ff0e2d03864b89a30376771a7da150189cd1;p=teuthology.git Fix corrupt repo detection Signed-off-by: Zack Cerza --- diff --git a/teuthology/worker.py b/teuthology/worker.py index 6676a9d2c9..cdd76483cc 100644 --- a/teuthology/worker.py +++ b/teuthology/worker.py @@ -91,10 +91,12 @@ def fetch_teuthology_branch(path, branch='master'): lock = filelock('%s.lock' % path) lock.acquire() try: - if os.path.isdir(path) and \ - not os.path.isdir(os.path.join(path, '.git')): - log.info("Removing possibly-corrupt repo for branch %s", branch) - shutil.rmtree(path) + if os.path.isdir(path): + p = subprocess.Popen('git status', shell=True) + if p.wait() == 128: + log.info("Repo at %s appears corrupt; removing", + branch) + shutil.rmtree(path) if not os.path.isdir(path): log.info("Cloning %s from upstream", branch)