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
diff --git a/git_refs.py b/git_refs.py
index 7feaffb..e0a85d7 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 @@
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'):