GNOME Bugzilla – Bug 585620
[win32 fixes] support using msys-based git
Last modified: 2021-05-17 15:49:47 UTC
Git is really awkward on Win32. It is available packaged as MSYSgit, which ships with its own MSYS environment which is best kept seperate from the main one.
With this in mind I made a patch that allows changing the git command to the form: c:/tools/git/bin/sh.exe -c "/c/tools/bin/git %s"
This is ugly but it makes MSYS git work perfectly with jhbuild. Here is the patch. I will be surprised if anyone likes it :) But I am not sure of a better way to do this.
Created attachment 136482 [details] [review]
support using msys git
Again I really do not like forcing exec parameters to be a string, while a list of arguments is just fine. I'd say this would be my main point against this patch.
Anyway, wouldn't it be possible to have a "git.bat" somewhere in the path, that would be an appropriate wrapper?
A git.bat is a much better idea than this crazy patch :) Wish I had thought of that before really ..
I've reimplemented this to use a git.bat. It's a much better solution.
Before I make up a patch, how should I include an example git.bat file? It's only one line but a *very* temperamental one so giving an example is a must :) I've been making a short README.windows file for my branch, could this go into master? I think that's the best idea.
By the way here is the beautiful one-liner:
@c:\\tools\\msys\\1.0\\bin\\sh.exe -c "/c/tools/git/bin/git %*"
Hardcoded paths are evil...
A hardcoded path is necessary here, because the user has installed git manually on Windows and it could be in any location.
The best solution is to package git as a standard MSYS component
Meantime, I've begun setting $SHELL to the MSYS shell when I run jhbuild. This has the side-effect that scripts run with subprocess.Popen() now execute with that shell instead of CMD.EXE. That allows us to just create a file called /bin/git:
cmd /c "c:\tools\git\bin\git $*"
You generally don't hardcode paths in a file. You either use environment variables or at the very least define a variable on top of your script using the hardcoded value, and use that variable in the rest of your program.
I agree that having git as a real MSYS component would be the best choice, but I don't know if it's easily doable...
-- GitLab Migration Automatic Message --
This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.
You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/jhbuild/-/issues/98.