z/OS Tools & Language

Expand all | Collapse all

Git log Colors are not interpreted correctly in more

  • 1.  Git log Colors are not interpreted correctly in more

    Posted 01-22-2018 18:18

    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.  RE: Git log Colors are not interpreted correctly in more

    Posted 01-23-2018 06:59

    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.  RE: Git log Colors are not interpreted correctly in more

    Posted 01-23-2018 08:56

    Hi Patrick,

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



  • 4.  RE: Git log Colors are not interpreted correctly in more

    Posted 01-23-2018 11:06

    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.  RE: Git log Colors are not interpreted correctly in more

    Posted 01-24-2018 04:10

    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.  RE: Git log Colors are not interpreted correctly in more

    Posted 11-26-2018 18:52

    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"