@@ -334,8 +334,9 @@ def _get_default_bash_path(cls):
334334 # This addresses issues where git hooks are intended to run assuming
335335 # the "native" Windows environment as seen by git.exe rather than
336336 # inside the git sandbox of WSL, which is likely configured
337- # independetly of the Windows Git. A noteworthy example are repos with
338- # Git LFS, where Git LFS may be installed in Windows but not in WSL.
337+ # independently of the Windows Git. A noteworthy example are repos
338+ # with Git LFS, where Git LFS may be installed in Windows but not
339+ # in WSL.
339340 if not is_win :
340341 return 'bash'
341342 try :
@@ -346,7 +347,7 @@ def _get_default_bash_path(cls):
346347 gitpath = Path (wheregit .decode (defenc ).splitlines ()[0 ])
347348 gitroot = gitpath .parent .parent
348349 gitbash = gitroot / 'bin' / 'bash.exe'
349- return str (gitbash ) if gitbash .exists else 'bash.exe'
350+ return str (gitbash ) if gitbash .exists () else 'bash.exe'
350351
351352 @classmethod
352353 def refresh_bash (cls , path : Union [None , PathLike ] = None ) -> bool :
@@ -357,7 +358,7 @@ def refresh_bash(cls, path: Union[None, PathLike] = None) -> bool:
357358 new_bash = os .path .abspath (new_bash )
358359 else :
359360 new_bash = os .environ .get (cls ._bash_exec_env_var )
360- if new_bash is None :
361+ if not new_bash :
361362 new_bash = cls ._get_default_bash_path ()
362363
363364 # Keep track of the old and new bash executable path.
@@ -369,7 +370,8 @@ def refresh_bash(cls, path: Union[None, PathLike] = None) -> bool:
369370 # executed for whatever reason.
370371 has_bash = False
371372 try :
372- run ([cls .GIT_PYTHON_BASH_EXECUTABLE , '--version' ])
373+ run ([cls .GIT_PYTHON_BASH_EXECUTABLE , '--version' ],
374+ check = True , stdout = PIPE )
373375 has_bash = True
374376 except CalledProcessError :
375377 pass
0 commit comments