Skip to content
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

config: check both git/etc and git/mingw64/etc on windows #1194

Merged
merged 1 commit into from
Jul 14, 2023
Merged
Changes from all commits
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
8 changes: 7 additions & 1 deletion dulwich/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,9 +620,15 @@ def _find_git_in_win_path():
for exe in ("git.exe", "git.cmd"):
for path in os.environ.get("PATH", "").split(";"):
if os.path.exists(os.path.join(path, exe)):
# exe path is .../Git/bin/git.exe or .../Git/cmd/git.exe
# in windows native shells (powershell/cmd) exe path is
# .../Git/bin/git.exe or .../Git/cmd/git.exe
#
# in git-bash exe path is .../Git/mingw64/bin/git.exe
git_dir, _bin_dir = os.path.split(path)
yield git_dir
parent_dir, basename = os.path.split(git_dir)
if basename == "mingw32" or basename == "mingw64":
yield parent_dir
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both Git/etc/... and Git/mingw64/etc/... exist in the windows Git installations I tried, but in all the cases I saw git was only using Git/etc/gitconfig (regardless of shell). But I'm not entirely sure that we can expect consistent behavior across all windows Git versions, so I went with the safe option of just yielding both Git/ and Git/mingw64/ whenever we are in the mingw/git-bash environment.

break


Expand Down