如何修复git日志输出(缺少少于几行)? [英] How to fix git log output (missing lines in less)?
问题描述
我有两台不同的服务器,每台服务器都运行Ubuntu安装。在他们两个上,我都设置了 env LESS = -FerX
,它确保git log输出很好地显示。
在其中一台服务器上,如果我运行 git log
,并且有动态包装的行,最上面的行消失。
例如:
log --pretty ='format:%C(3)[%h]%Cgreen%an%Creset%n%cd%s%Cred%d%Creset'--graph
服务器1上的输出:
* [1234457] John Doe
|日期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
|日期fooooo bar baz
:
服务器2上的输出:
fooooo bar baz fooooo bar baz fooooo bar baz fooooo bar baz fooooo bar baz fooooo
bar baz
* [4567890] Richard Miles
|日期fooooo bar baz
* [0815123] Mary Major
|日期fooooo酒吧baz fooooo酒吧baz fooooo酒吧baz
:
任何想法如何解决这个问题?
同样,我在问了几分钟后才找到自己问题的答案。 b $ b
原来问题在于 -r
参数< -R
。
从手册页:
-R或--RAW-CONTROL-CHARS
与-r类似,但只有ANSIcolor转义序列以raw形式输出。
与-r不同,大多数情况下屏幕外观都保持正确。
对于我未知的某些共振,小写 -r
可以正常工作。
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?
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.
这篇关于如何修复git日志输出(缺少少于几行)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!