From bed8b62345e484b27e048e8f21280c5611f795df Mon Sep 17 00:00:00 2001 From: Renaud Paquay Date: Thu, 27 Sep 2018 10:46:58 -0700 Subject: Add support for long paths * Add more file i/o wrappers in platform_utils to allow using long paths (length > MAX_PATH) on Windows. * Paths using the long path syntax ("\\?\" prefix) should never escape the platform_utils API surface area, so that this specific syntax is not visible to the rest of the repo code base. * Forward many calls from os.xxx to platform_utils.xxx in various place to ensure long paths support, specifically when repo decides to delete obsolete directories. * There are more places that need to be converted to support long paths, this commit is an initial effort to unblock a few common use cases. * Also, fix remove function to handle directory symlinks Change-Id: If82ccc408e516e96ff7260be25f8fd2fe3f9571a --- git_refs.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'git_refs.py') diff --git a/git_refs.py b/git_refs.py index 7feaffb1..e0a85d7a 100644 --- a/git_refs.py +++ b/git_refs.py @@ -15,6 +15,7 @@ import os from trace import Trace +import platform_utils HEAD = 'HEAD' R_CHANGES = 'refs/changes/' @@ -127,9 +128,9 @@ class GitRefs(object): def _ReadLoose(self, prefix): base = os.path.join(self._gitdir, prefix) - for name in os.listdir(base): + for name in platform_utils.listdir(base): p = os.path.join(base, name) - if os.path.isdir(p): + if platform_utils.isdir(p): self._mtime[prefix] = os.path.getmtime(base) self._ReadLoose(prefix + name + '/') elif name.endswith('.lock'): -- cgit v1.2.3-54-g00ecf