File tree Expand file tree Collapse file tree 2 files changed +5
-10
lines changed
Expand file tree Collapse file tree 2 files changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -634,7 +634,7 @@ def read(self) -> None: # type: ignore[override]
634634self ._read (file_path , file_path .name )
635635else :
636636# Assume a path if it is not a file-object.
637- file_path = cast ( PathLike , file_path )
637+ file_path = os . fspath ( file_path )
638638try :
639639with open (file_path , "rb" ) as fp :
640640file_ok = True
Original file line number Diff line number Diff line change @@ -219,11 +219,9 @@ def __init__(
219219# Given how the tests are written, this seems more likely to catch Cygwin
220220# git used from Windows than Windows git used from Cygwin. Therefore
221221# changing to Cygwin-style paths is the relevant operation.
222- epath = cygpath (epath if isinstance ( epath , str ) else epath . __fspath__ ( ))
222+ epath = cygpath (os . fspath ( epath ))
223223
224- epath = epath or path or os .getcwd ()
225- if not isinstance (epath , str ):
226- epath = epath .__fspath__ ()
224+ epath = os .fspath (epath )
227225if expand_vars and re .search (self .re_envvars , epath ):
228226warnings .warn (
229227"The use of environment variables in paths is deprecated"
@@ -1361,11 +1359,8 @@ def _clone(
13611359 ) -> "Repo" :
13621360odbt = kwargs .pop ("odbt" , odb_default_type )
13631361
1364- # When pathlib.Path or other class-based path is passed
1365- if not isinstance (url , str ):
1366- url = url .__fspath__ ()
1367- if not isinstance (path , str ):
1368- path = path .__fspath__ ()
1362+ url = os .fspath (url )
1363+ path = os .fspath (path )
13691364
13701365## A bug win cygwin's Git, when `--bare` or `--separate-git-dir`
13711366# it prepends the cwd or(?) the `url` into the `path, so::
You can’t perform that action at this time.
0 commit comments