There was an error while loading. Please reload this page.
1 parent 5335416 commit fd78a53Copy full SHA for fd78a53
1 file changed
git/util.py
@@ -197,7 +197,7 @@ def patch_env(name: str, value: str) -> Generator[None, None, None]:
197
os.environ[name] = old_value
198
199
200
-def rmtree(path: PathLike) -> None:
+def _rmtree_windows(path: PathLike) -> None:
201
"""Remove the given directory tree recursively.
202
203
:note: We use :func:`shutil.rmtree` but adjust its behaviour to see whether files
@@ -225,6 +225,17 @@ def handler(function: Callable, path: PathLike, _excinfo: Any) -> None:
225
shutil.rmtree(path, onerror=handler)
226
227
228
+def _rmtree_posix(path: PathLike) -> None:
229
+ """Remove the given directory tree recursively."""
230
+ return shutil.rmtree(path)
231
+
232
233
+if os.name == "nt":
234
+ rmtree = _rmtree_windows
235
+else:
236
+ rmtree = _rmtree_posix
237
238
239
def rmfile(path: PathLike) -> None:
240
"""Ensure file deleted also on *Windows* where read-only files need special treatment."""
241
if osp.isfile(path):
0 commit comments