After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 585620 - [win32 fixes] support using msys-based git
[win32 fixes] support using msys-based git
Product: jhbuild
Classification: Infrastructure
Component: general
Other Windows
: Normal enhancement
: ---
Assigned To: Jhbuild maintainers
Jhbuild QA
Depends on:
Reported: 2009-06-13 03:07 UTC by Sam Thursfield
Modified: 2021-05-17 15:49 UTC
See Also:
GNOME target: ---
GNOME version: ---

support using msys git (20.59 KB, patch)
2009-06-13 03:08 UTC, Sam Thursfield
reviewed Details | Review

Description Sam Thursfield 2009-06-13 03:07:09 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.
Comment 1 Sam Thursfield 2009-06-13 03:08:31 UTC
Created attachment 136482 [details] [review]
support using msys git
Comment 2 Frederic Peters 2009-06-13 06:01:23 UTC
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?
Comment 3 Sam Thursfield 2009-06-13 12:29:23 UTC
A git.bat is a much better idea than this crazy patch :) Wish I had thought of that before really ..
Comment 4 Sam Thursfield 2009-07-03 17:39:19 UTC
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 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 %*"
Comment 5 Luis Menina 2011-08-23 12:47:26 UTC
Hardcoded paths are evil...
Comment 6 Sam Thursfield 2011-12-31 00:22:43 UTC
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 $*"
Comment 7 Luis Menina 2011-12-31 14:43:55 UTC
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...
Comment 8 GNOME Infrastructure Team 2021-05-17 15:49:47 UTC
-- 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: