Products Resources Support About Us

Git log Colors are not interpreted correctly in more

git

#1

https://forum.rocketsoftware.com/t/colors-are-not-interpreted-correctly-when-using-git-diff/612

Similar to the above post, as we do not have less installed at our shop, I was looking for alternative pagers to set for git core.pager. I came across “more” and “pg”. When I set more as the pager, I get all sorts of funky output which seems to be “more” not interpreting the colors correctly(see below).

When using ‘pg’ as the pager, the log looks like this:

Is there any way to configure “more” so that it interprets colors correctly? I really like the scrolling functionality, pg is not intuitive to use.


#2

Hi Patrick,

Thank you for the report.
On first sight as you said, more do not interpreter the colors correctly.

I did
git config --global core.pager 'pg’
git log --color > log_pg
git config --global core.pager 'more’
git log --color > log_more

diff -s log_more log_pg
Files log_more and log_pg are identical

And it looks that the problem in more, not in git.
We are looking into the problem, but probably it will take some time to find how it can be avoid.

Thanks,
Sergey


#3

Hi Patrick,

Unfortunately, standard tool /bin/more doesn’t support ESC-sequence on z/OS.


#4

So from what I gather, pg is the only pager that will work on z/OS? Does less work, or is there some way to fix this like Sergey suggested?

Thanks,


#5

Since /bin/more doesn’t support ESC-sequence on z/OS, probably, there is only way to switch off the colors and hide the color tags:
git config --global color.ui false
git config --global core.pager ‘more’

or use another pager: pg or less

Thanks,
Sergey


#6

Less works for me with color codes. I had to download the src and compile it myself. But it works! I also had to add the following config for color codes (as you probably guessed) -

  > git config --global core.pager "less -r"