@@ -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.
339340if not is_win :
340341return 'bash'
341342try :
@@ -346,7 +347,7 @@ def _get_default_bash_path(cls):
346347gitpath = Path (wheregit .decode (defenc ).splitlines ()[0 ])
347348gitroot = gitpath .parent .parent
348349gitbash = 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
352353def refresh_bash (cls ,path :Union [None ,PathLike ]= None )-> bool :
@@ -357,7 +358,7 @@ def refresh_bash(cls, path: Union[None, PathLike] = None) -> bool:
357358new_bash = os .path .abspath (new_bash )
358359else :
359360new_bash = os .environ .get (cls ._bash_exec_env_var )
360- if new_bash is None :
361+ if not new_bash :
361362new_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.
370371has_bash = False
371372try :
372- run ([cls .GIT_PYTHON_BASH_EXECUTABLE ,'--version' ])
373+ run ([cls .GIT_PYTHON_BASH_EXECUTABLE ,'--version' ],
374+ check = True ,stdout = PIPE )
373375has_bash = True
374376except CalledProcessError :
375377pass