From 98ec1f70c34ae02be01eb1b7969d85d8cb57e937 Mon Sep 17 00:00:00 2001 From: Peter Rowlands Date: Fri, 14 Jul 2023 15:04:35 +0900 Subject: [PATCH] config: check both git/etc and git/mingw64/etc for system gitconfig on windows --- dulwich/config.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dulwich/config.py b/dulwich/config.py index 511bc3ce2..0d47e2b8b 100644 --- a/dulwich/config.py +++ b/dulwich/config.py @@ -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 break