based on #1912, some old upstreaming process: https://github.com/gitgitgadget/git/pull/612/
In theory the script needs some way to detect a MSYS2 mingw env and special case some
things on top of that in combination with is_Cygwin.
Since we want to keep this diff small, keep it hacky.