Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix git log output (missing lines in less)?

Tags:

git

terminal

I have two different servers each running a Ubuntu installation. On both of them, I have set env LESS=-FerX which makes sure that git log output is displayed nicely. Also, line wrapping is turned on.

On one of the servers, if I run git log and there are dynamically-wrapped lines, the topmost lines disappear.

For example:

log --pretty='format:%C(3)[%h] %Cgreen%an%Creset%n %cd %s %Cred%d%Creset' --graph

Output on Server 1:

* [1234457] John Doe
| Date fooooo bar baz fooooo bar baz fooooo bar baz fooooo bar baz fooooo bar baz
fooooo bar baz fooooo bar baz fooooo bar baz fooooo bar baz fooooo bar baz fooooo
bar baz
* [4567890] Richard Miles
| Date fooooo bar baz
:

Output on Server 2:

fooooo bar baz fooooo bar baz fooooo bar baz fooooo bar baz fooooo bar baz fooooo
bar baz
* [4567890] Richard Miles
| Date fooooo bar baz
* [0815123] Mary Major
| Date fooooo bar baz fooooo bar baz fooooo bar baz
:

Any idea how to fix this?

like image 375
user123444555621 Avatar asked Aug 08 '11 14:08

user123444555621


1 Answers

Again, I find the answer to my own question only minutes after asking.

Turns out the problem was the -r parameter to less. It should have been a -R instead.

From the manpage:

-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.

For some reson not known to me, the lower-case -r works fine on of the other server.

like image 83
user123444555621 Avatar answered Sep 26 '22 20:09

user123444555621