-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Teach msys2-runtime to hand the tty through to Git #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
We haven't discussed this is yet IIRC, and IMO mintty should not be the default. Our goal is to provide a good native Git experience on Windows. It is not our goal to make MSYS2 tools in general work nicely on Windows. That said, for native Windows applications there are better Consoles than mintty, in particular ConEmu (or its Cmder flavor) and Console Z (a Console 2 fork). |
Frankly, I do not really care which terminal we use, as long as it is fully resizable and has a sane copy function (i.e. non-rectangular, but line selections). Both are offered by mintty, so I would be fine with it. But even if we choose to ship with another terminal (which BTW would have to be bundled as a Pacman package to keep the script simple that makes the installer), we still need what this ticket is about: a way to teach msys2-runtime to hand through the tty to Git so that |
I updated the description of the ticket so it does not mention mintty anymore. |
Hold on, something does not quite work yet. |
Okay, now it works. @sschuberth @t-b please have a look and continue to be merciless 😼 |
Please note that I pushed the |
Could you also briefly explain why we didn't need this with MSYS1? |
@sschuberth Apart from the retracted |
MSys2 has a slightly different notion of what constitutes a tty than the Microsoft C runtime. The former knows whether stdin/stdout/stderr was redirected or not, while the latter looks for a Win32 Console. In particular when we want to know whether to spawn a pager or not, we would rather want to know what MSys2 thinks. We are about to introduce a change to the msys2-runtime that sets an environment variable MSYS_TTY_HANDLES to a list of Win32 handles that correspond to stdin/stdout/stderr, respectively, *but skips* handles that MSys2 does not think are terminals. This commit handles that input to augment the isatty() function to return 1 also when MSYS_TTY_HANDLES contains the corresponding handle. The only time when Git needs to know whether a Console is attached or not is when winansi.c is asked to Do Its Thing, therefore we refrain from overriding isatty there. Note: this was an issue with MSys1-based Git for Windows, too, hidden by the fact that Git for Windows used `cmd.exe` as a terminal -- which is backed by a real Win32 Console. Had MSys1 used, say, rxvt as its default terminal, the symptom would have been that "git log" does not spawn a pager by default but instead outputs the entire history (without color coding, too). In MSys2, the default terminal is mintty, therefore we finally could not avoid to address the issue. Signed-off-by: Johannes Schindelin <[email protected]>
Looks good to me now. I'll leave the merge to you to sync with git-for-windows/msys2-runtime#4. |
Teach msys2-runtime to hand the tty through to Git
Thanks, @sschuberth! |
Teach msys2-runtime to hand the tty through to Git
Teach msys2-runtime to hand the tty through to Git
Teach msys2-runtime to hand the tty through to Git
(Experimental) Trace2 base plus GVFS extensions
(Experimental) Trace2 base plus GVFS extensions
When we were using
winpty
, thegit log
command called the pager correctly. However, without usingwinpty
this is not the case. Most likely, there is a way to teach themsys2-runtime
to special-casegit.exe
and pass the tty through so that Git knows that it is running inside a console.Note: this is only an issue when not running in
cmd.exe
. However, we want to switch to a nicer terminal in the upcoming Git for Windows release.