What are the differences between msys/git and git-for-windows/mingw-w64-x86_64-git?

后端 未结 2 1553
慢半拍i
慢半拍i 2021-01-30 17:02

To be able to run the test scripts for my cross-platform application also on Windows, I installed MSYS2 and used pacman to install any packages my test scripts rely on.

相关标签:
2条回答
  • 2021-01-30 17:21

    msys/git is linked against a dynamic library provided by MSYS2 to provide POSIX-to-Windows compatibility (POSIX emulation) in a manner similar to how cygwin does (MSYS2 is forked from cygwin), thus it requires the MSYS2 environment to be present to run.

    git-for-windows/mingw-w64-x86_64-git on the other hand, is compiled using the MinGW compiler, which performs the translation to native Windows calls at compile time, which results in a much faster binary compared to the emulation approach, and does only require native Windows libraries to run.

    From The difference between MSYS2 and MinGW:

    The POSIX emulation layer of MSYS2 binaries is convenient, but comes at a cost: Typically, MSYS2 programs are noticably slower than their MinGW counterparts (if there are such counterparts). As a consequence, the Git for Windows project tries to provide as many components as possible as MinGW binaries.

    See also: How does MSYS2 differ from Cygwin?

    0 讨论(0)
  • git-for-windows/git issue 2688 adds a more recent (2020) perspective, from the maintainer of Git for Windows Johannes Schindelin:

    The purpose of Git for Windows is really to bring Git to Windows.

    While that implies that we have to ship quite a few Unix-like tools, it does not mean that we will include such tools unless they are needed for Git's own operations, or at least for historical reasons (needs of active contributors are sometimes a factor in deciding whether to include a tool or not).

    Having said that, what you really are looking for is MSYS2.
    Git for Windows leverages MSYS2 and ships with a subset of its files. MSYS2 even sports a package management system called "pacman" to install more tools (including Git...).

    The documentation is "Install inside MSYS2 proper" as noted in the question, but it has recently changed, since Pacboy is removed from the base installation.

    So it needs to be added back with:

    # pacman -Fy
    :: Synchronizing package databases...
    [...]
    # pacman -F pacboy.exe
    # pacman -F pacboy
    msys/pactoys-git r2.07ca37f-1 (base base-devel)
        usr/bin/pacboy
        usr/share/bash-completion/completions/pacboy
    

    Then:

    Copying /var/lib/pacman/local files over from my msys2 installation into git-bash's, I was able to install tmux (as I planned/showed in OP), and it is working fine for me.

    So, having /var/lib/pacman/local files is all it take for msys2 and pacman to work within git-bash (I meant git-for-windows).

    0 讨论(0)
提交回复
热议问题