06 / 07
Environment and platforms
The differences between terminals are absorbed by the tool instead of being pushed onto you.
Environment variables
| Variable | What it does |
|---|---|
MGIT_GIT | The name or path of the git executable (default git) |
MGIT_COLOR | auto, always or never; beats terminal detection |
MGIT_ASCII | 1 forces the ASCII glyphs, 0 forces the Unicode ones |
NO_COLOR | Disables colour when set to a non empty value |
CLICOLOR_FORCE | Forces colour when set to something other than 0 |
CLICOLOR | Disables colour when set to 0 |
MGIT_VERSION | The version the installer should fetch, for example 2.0.0 |
MGIT_INSTALL_DIR | The directory the installer should install into |
Precedence: the command line, then MGIT_*, then CLICOLOR_FORCE, then NO_COLOR, then terminal detection.
Try the precedence: CLICOLOR_FORCE=1 NO_COLOR=1 mgit --summary
Platform behaviour
| Situation | Behaviour |
|---|---|
| Output redirected (pipe, file, CI log) | colour off, plain text only |
Windows cmd.exe / Windows PowerShell 5.1 | virtual terminal mode is enabled at startup so ANSI works; colour is disabled when it cannot be |
| A Windows console whose code page is not UTF-8 | ASCII glyphs, so the emoji cannot turn into noise |
| PowerShell 7, Windows Terminal, macOS, Linux | the Unicode glyphs |
A POSIX locale that is not UTF-8 (LANG=C) | ASCII glyphs; MGIT_ASCII=0 forces Unicode back |
mgit … | head | the default SIGPIPE behaviour is restored, so a closed pipe ends the run quietly |
git on Windows | found through PATH (including PATHEXT); MGIT_GIT can point at a full path |
The "where the output goes" control in the playground switches between these situations, so you can watch the same command change.
Switch the output target and run it again: mgit --summary
When git is missing
mgit checks that git can be started before it does anything. When it cannot, mgit prints one error with the install hint for that platform and exits with 127.