and no particular settings regarding colors in <repository>/.git/config
[color]
diff = auto
status = auto
branch = auto
log = auto
Although I was not using a Mac, the solution was in this blog post: that is, setting the GIT_PAGER variable to cat was already solving the problem; GIT_PAGER sets which program should be used by git to display for example the diff and log output (default less).
The actual problem was in less and how it outputs ANSI color ESC codes. A solution, similarly to what suggested in that post, was to set the LESS variable to -R and leave GIT_PAGER unset, as it originally was. Regarding the other options suggested in the blog post for LESS, -X and -e have no influence on color display, and -R is probably better than -r; in particular, this in an extract of the less manual, at the -r/-R section, explaining why:
The actual problem was in less and how it outputs ANSI color ESC codes. A solution, similarly to what suggested in that post, was to set the LESS variable to -R and leave GIT_PAGER unset, as it originally was. Regarding the other options suggested in the blog post for LESS, -X and -e have no influence on color display, and -R is probably better than -r; in particular, this in an extract of the less manual, at the -r/-R section, explaining why:
-r or --raw-control-chars
Causes "raw" control characters to be displayed.
[...] Warning: when the -r option is used, less cannot
keep track of the actual appearance of the screen
(since this depends on how the screen responds to
each type of control character). Thus, various display
problems may result, such as long lines being split
in the wrong place.
-R or --RAW-CONTROL-CHARS
Like -r, but only ANSI "color" escape sequences are
output in "raw" form. Unlike -r, the screen appearance
is maintained correctly in most cases. [...]
No comments:
Post a Comment