merger: ensure .git/refs is not removed as a leaked dirs

This change ensures the .git/refs directory is not removed as this
prevents further git operation.

Change-Id: Ia314103d6807b755de3cf11eb7e7d4151626326f
This commit is contained in:
Tristan Cacqueray 2020-04-25 14:41:05 +00:00
parent ccddc37fa0
commit 769ecde8fc
1 changed files with 1 additions and 1 deletions

View File

@ -310,7 +310,7 @@ class Repo(object):
def _cleanup_leaked_ref_dirs(local_path, log, messages):
for root, dirs, files in os.walk(
os.path.join(local_path, '.git/refs'), topdown=False):
if not os.listdir(root):
if not os.listdir(root) and not root.endswith('.git/refs'):
if log:
log.debug("Cleaning empty ref dir %s", root)
else: