Skip to content

Commit

Permalink
Merge pull request #1194 from pmrowla/win-git-bash
Browse files Browse the repository at this point in the history
config: check both `git/etc` and `git/mingw64/etc` on windows
  • Loading branch information
jelmer authored Jul 14, 2023
2 parents 75b0369 + 98ec1f7 commit 879fe6a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion dulwich/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,9 +633,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


Expand Down

0 comments on commit 879fe6a

Please sign in to comment.