Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6de8e67

Browse files
committed
Refactor current fix for symlink-following bug
This keeps the same approach, but expresses it better. This doesnot update the tests (yet), so one test is still failing.
1 parentfd78a53 commit6de8e67

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

‎git/util.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def patch_env(name: str, value: str) -> Generator[None, None, None]:
197197
os.environ[name]=old_value
198198

199199

200-
def_rmtree_windows(path:PathLike)->None:
200+
defrmtree(path:PathLike)->None:
201201
"""Remove the given directory tree recursively.
202202
203203
:note: We use :func:`shutil.rmtree` but adjust its behaviour to see whether files
@@ -219,23 +219,14 @@ def handler(function: Callable, path: PathLike, _excinfo: Any) -> None:
219219
raiseSkipTest(f"FIXME: fails with: PermissionError\n{ex}")fromex
220220
raise
221221

222-
ifsys.version_info>= (3,12):
222+
ifos.name!="nt":
223+
shutil.rmtree(path)
224+
elifsys.version_info>= (3,12):
223225
shutil.rmtree(path,onexc=handler)
224226
else:
225227
shutil.rmtree(path,onerror=handler)
226228

227229

228-
def_rmtree_posix(path:PathLike)->None:
229-
"""Remove the given directory tree recursively."""
230-
returnshutil.rmtree(path)
231-
232-
233-
ifos.name=="nt":
234-
rmtree=_rmtree_windows
235-
else:
236-
rmtree=_rmtree_posix
237-
238-
239230
defrmfile(path:PathLike)->None:
240231
"""Ensure file deleted also on *Windows* where read-only files need special treatment."""
241232
ifosp.isfile(path):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp