Terminal emulation issues running git for windows 2.8.4 in a cygwin/mintty terminal

137 views
Skip to first unread message

Stephen Morton

unread,
Jun 24, 2016, 9:17:33 AM6/24/16
to git-for-windows
I'm trying run git for windows within a cygwin bash/mintty terminal (*). Everything mostly works, but some terminal emulation stuff does not work
  • 'git log' is not coloured by default, although it will work if I manually do 'git log --color'
  • The pager does not work.

 > git --version
git version 2.8.4.windows.1

Is there some configuration or environment variable I can set to get git to recognize my terminal?

Steve

(*) I know that's kind of crazy. But we have a cygwin environment based on an older 32-bit version of cygwin and I'd like to just drop a Windows git into it. Yes, I can recompile a newer cygwin git, but it will still be 32-bit and that's one of the things causing me problems. Could I just run everything I need to run within the git bash shell... alas no. Just trust me that I'm only asking after doing a bunch of experiments within cygwin already. 

Erik Faye-Lund

unread,
Jun 24, 2016, 10:43:26 AM6/24/16
to Stephen Morton, git-for-windows
On Thu, Jun 23, 2016 at 10:19 PM, Stephen Morton
<stephen....@gmail.com> wrote:
> I'm trying run git for windows within a cygwin bash/mintty terminal (*).
> Everything mostly works, but some terminal emulation stuff does not work
>
> 'git log' is not coloured by default, although it will work if I manually do
> 'git log --color'

The problem here is that your terminal doesn't support colors *the
windows way*, only the unix way. Git for Windows, being a Windows
program does not know about the unix way.

The fact that explicitly setting colors works, is because when Git for
windows has no idea how to output colors, yet it was requested, it'll
just output ANSI color sequences, which is "the unix way" above. I'd
actually consider that latter part a minor bug, but I'm not opposed to
leaving it that way to keep this work-flow working.

Anyway, you might want to try "git config --global color.ui true" to
avoid having to specify this over and over again.

> The pager does not work.

You probably want to play around with the core.pager config. There's a
section on https://git-scm.com/docs/git-config about how that config
variable works.

Johannes Schindelin

unread,
Jun 24, 2016, 1:29:29 PM6/24/16
to Erik Faye-Lund, Stephen Morton, git-for-windows
Hi,

On Fri, 24 Jun 2016, Erik Faye-Lund wrote:

> On Thu, Jun 23, 2016 at 10:19 PM, Stephen Morton
> <stephen....@gmail.com> wrote:
> > I'm trying run git for windows within a cygwin bash/mintty terminal (*).
> > Everything mostly works, but some terminal emulation stuff does not work
> >
> > 'git log' is not coloured by default, although it will work if I manually do
> > 'git log --color'
>
> The problem here is that your terminal doesn't support colors *the
> windows way*, only the unix way. Git for Windows, being a Windows
> program does not know about the unix way.

To add even more information: MinTTY, whether it runs in its Cygwin
incarnation or in its MSYS2 one, requires an emulated /dev/tty to interact
correctly with the pager. The problem you have is that Cygwin's MinTTY
uses Cygwin's emulation, and that is similar to, but still incompatible
with, MSYS2's emulation. And it is the latter that is used by Git for
Windows.

> The fact that explicitly setting colors works, is because when Git for
> windows has no idea how to output colors, yet it was requested, it'll
> just output ANSI color sequences, which is "the unix way" above. I'd
> actually consider that latter part a minor bug, but I'm not opposed to
> leaving it that way to keep this work-flow working.
>
> Anyway, you might want to try "git config --global color.ui true" to
> avoid having to specify this over and over again.
>
> > The pager does not work.
>
> You probably want to play around with the core.pager config. There's a
> section on https://git-scm.com/docs/git-config about how that config
> variable works.

Indeed. If you override the pager to be *Cygwin*'s less.exe, it might just
work.

While I am sympathetic to the woes you have, there is too much on my plate
to even try to tackle this problem.

Stephen, if you want to give it a try, and do not shy away from hacking on
the MSYS2 runtime, I am of course more than happy to point you to the code
locations that would need to be patched for MSYS2's less.exe to at least
try to access Cygwin's tty emulation.

Ciao,
Johannes

Stephen Morton

unread,
Jun 27, 2016, 10:01:15 AM6/27/16
to git-for-windows, kusm...@gmail.com, stephen....@gmail.com
Thanks Erik and Johannes,

Unfortunately, I could not get any value of GIT_PAGER (or core.pager) to work. Also, interestingly, although 'git log --color' will colourize, I could not get any value of color.ui to produce colourization.

Before we see if we can  make a patch to make this work, do you think this is a fool's errand, trying to get Windows git working in a cygwin/mintty terminal? Do you suspect we'll just face an endless list of little annoyances and it will never work satisfactorily?

Stephen

Reply all
Reply to author
Forward
0 new messages