Skip to content

Fix typo in _get_exe_extensions PATHEXT fallback #1890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix typo in _get_exe_extensions PATHEXT fallback
PATHEXT lists file extensions with the ".". In the fallback given
in _get_exe_extensions, the other extensions had this, but ".COM"
was listed without the ".". This fixes that.

This is very minor because _get_exe_extensions is nonpublic and not
currently used on native Windows, which is the platform where the
PATHEXT fallback code would be used.

Specifically, _get_exe_extensions is called only in py_where, which
while named with no leading underscore is nonpublic do not being
(and never having been) listed in __all__. As its docstring states,
it is an implementation detail of is_cygwin_git and not intended
for any other use. More specifically, is_cygwin_git currently
immediately returns False on *native* Windows (even if the git
executable GitPython is using is a Cygwin git executable). Only on
Cygwin, or other systems that are not native Windows, does it try
to check the git executable (by calling its _is_cygwin_git helper,
which uses py_where).
  • Loading branch information
EliahKagan committed Mar 31, 2024
commit 988d97bf12c5b15ff4693a5893134271dd8d8a28
2 changes: 1 addition & 1 deletion git/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def _get_exe_extensions() -> Sequence[str]:
if PATHEXT:
return tuple(p.upper() for p in PATHEXT.split(os.pathsep))
elif sys.platform == "win32":
return (".BAT", "COM", ".EXE")
return (".BAT", ".COM", ".EXE")
else:
return ()

Expand Down