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

Commit90dc03d

Browse files
committed
Minor bug fixes
Added tilde expansion as part of the refresh function. Added pythonversion check such that we properly capture PermissionError in Python>=3 and OSError in Python <3.
1 parent79a36a5 commit90dc03d

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

‎git/cmd.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ def refresh(cls, path=None):
203203
"""
204204
# discern which path to refresh with
205205
ifpathisnotNone:
206-
new_git=os.path.abspath(path)
206+
new_git=os.path.expanduser(path)
207+
new_git=os.path.abspath(new_git)
207208
else:
208209
new_git=os.environ.get(cls._git_exec_env_var,cls.git_exec_name)
209210

@@ -212,14 +213,23 @@ def refresh(cls, path=None):
212213
cls.GIT_PYTHON_GIT_EXECUTABLE=new_git
213214

214215
# test if the new git executable path is valid
216+
217+
ifsys.version_info< (3,):
218+
# - a GitCommandNotFound error is spawned by ourselves
219+
# - a OSError is spawned if the git executable provided
220+
# cannot be executed for whatever reason
221+
exceptions= (GitCommandNotFound,OSError)
222+
else:
223+
# - a GitCommandNotFound error is spawned by ourselves
224+
# - a PermissionError is spawned if the git executable provided
225+
# cannot be executed for whatever reason
226+
exceptions= (GitCommandNotFound,PermissionError)
227+
215228
has_git=False
216229
try:
217230
cls().version()
218231
has_git=True
219-
except (GitCommandNotFound,PermissionError):
220-
# - a GitCommandNotFound error is spawned by ourselves
221-
# - a PermissionError is spawned if the git executable provided
222-
# cannot be executed for whatever reason
232+
exceptexceptions:
223233
pass
224234

225235
# warn or raise exception if test failed

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp