Windows PATH not set correctly when running via git mergetool
Issue
Meld.exe raises an error because it can't find dependent extension DLLs when executed as the editor for git mergetool
.
Error
Steps to reproduce
These steps assume that the user is in a git repository that is in the middle of a conflicted merge. Steps for that are at the end.
The system does not have pygtk, pycairo, or any other 3rd party python packages installed for the interpreter. It is running CPython 3.7.
$ git config merge.tool meld
$ git config mergetool.meld.path "C:/Program Files (x86)/Meld/Meld.exe"
$ git mergetool
A conflicted repo can be made with the following, starting in some comfortable parent folder:
$ git init A
$ cd A
$ echo "aaa" > test.txt
$ git add .
$ git commit -ma
$ git branch test
$ echo "bbb" >> test.txt
$ git commit -amb
$ git checkout test
$ echo "ccc" >> test.txt
$ git commit -amc
$ git merge master
Workaround
The error goes away if we add C:/Program Files (x86)/Meld/lib
to the PATH
, since that's where the missing DLLs live.
The error message is also a bit misleading: there is no C:\msys64
on my system. where python
/which python
show my normal anaconda install.
Note
This issue is based on https://stackoverflow.com/q/58100654/2988730. In attempting to answer the question, I've come fairly close to determining the root cause, but need more time to browse the code to figure out where exactly the windows exe gets made. Right now my best bet is setup_win32.py in one project root. Any pointers would be helpful, but I'd like to take a crack at this myself if that's ok.