Wrong default configuration of less(1) breaks Git and Mercurial
by krown from LinuxQuestions.org on (#5NXZJ)
I'm trying the latest current, i.e. 15-RC1. After cloning some Git repository commands like 'git branch' and 'git log' don't support colored output and show it as literal escape sequences. For example: "* ESC[32mmasterESC[m". The same issue happens with Mercurial (hg) as well. Probably there are other broken programs like Git and Mercurial.
This happens because /etc/profile sets LESS="-M", probably for prompt of man(1) to look nicer. As a workaround I can set 'core.pager = less -r' in my Git configuration but I think this is wrong and can only be a temporary workaround.
I think the real solution would be teaching man(1) to run 'less -PM' by itself and not by the LESS environment variable.
This happens because /etc/profile sets LESS="-M", probably for prompt of man(1) to look nicer. As a workaround I can set 'core.pager = less -r' in my Git configuration but I think this is wrong and can only be a temporary workaround.
I think the real solution would be teaching man(1) to run 'less -PM' by itself and not by the LESS environment variable.