From 87e7ff0e2d03864b89a30376771a7da150189cd1 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Fri, 6 Jun 2014 12:01:33 -0500 Subject: [PATCH] Fix corrupt repo detection Signed-off-by: Zack Cerza --- teuthology/worker.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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) -- 2.39.5