Skip to main content
Jan 22, 2018 6:18 PM UTC

Git log Colors are not interpreted correctly in more

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.

    5 replies

    Sergey Rezepin
    Rocketeer
    Jan 23, 2018 6:59 AM UTC

    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.

    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

    Tatiana Balaburkina
    Rocketeer
    Jan 23, 2018 8:56 AM UTC

    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.

    Hi Patrick,

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

    Jan 23, 2018 11:06 AM UTC

    Hi Patrick,

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

    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,

    Sergey Rezepin
    Rocketeer
    Jan 24, 2018 4:10 AM UTC

    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.

    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

    Nov 26, 2018 6:52 PM UTC

    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

    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"