diff options
author | Renaud Paquay <rpaquay@google.com> | 2018-09-27 10:46:58 -0700 |
---|---|---|
committer | Renaud Paquay <rpaquay@google.com> | 2018-10-22 08:16:35 -0700 |
commit | bed8b62345e484b27e048e8f21280c5611f795df (patch) | |
tree | 4efc8203f0a092428377ebc3e3494f01fdb9b90c /git_refs.py | |
parent | b3133a31642ea88f0e4fe9c382411d43278dc9e4 (diff) | |
download | git-repo-bed8b62345e484b27e048e8f21280c5611f795df.tar.gz |
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
Diffstat (limited to 'git_refs.py')
-rw-r--r-- | git_refs.py | 5 |
1 files changed, 3 insertions, 2 deletions
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 @@ | |||
15 | 15 | ||
16 | import os | 16 | import os |
17 | from trace import Trace | 17 | from trace import Trace |
18 | import platform_utils | ||
18 | 19 | ||
19 | HEAD = 'HEAD' | 20 | HEAD = 'HEAD' |
20 | R_CHANGES = 'refs/changes/' | 21 | R_CHANGES = 'refs/changes/' |
@@ -127,9 +128,9 @@ class GitRefs(object): | |||
127 | 128 | ||
128 | def _ReadLoose(self, prefix): | 129 | def _ReadLoose(self, prefix): |
129 | base = os.path.join(self._gitdir, prefix) | 130 | base = os.path.join(self._gitdir, prefix) |
130 | for name in os.listdir(base): | 131 | for name in platform_utils.listdir(base): |
131 | p = os.path.join(base, name) | 132 | p = os.path.join(base, name) |
132 | if os.path.isdir(p): | 133 | if platform_utils.isdir(p): |
133 | self._mtime[prefix] = os.path.getmtime(base) | 134 | self._mtime[prefix] = os.path.getmtime(base) |
134 | self._ReadLoose(prefix + name + '/') | 135 | self._ReadLoose(prefix + name + '/') |
135 | elif name.endswith('.lock'): | 136 | elif name.endswith('.lock'): |