msysGit:为什么git log输出空行? [英] msysGit: Why does git log output blank lines?

查看:148
本文介绍了msysGit:为什么git log输出空行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎在我输入命令到终端窗口底部的距离越近的位置插入的空行越少。如果我在终端窗口的顶部键入它,它会插入空白线的几乎整个窗口高度;如果我在最底部键入它,则不会插入空行。

看起来好像寻呼机程序将输出推送到终端窗口的底部,但我希望输出正好在我的命令之下或顶部,就像Linux git。



我可以通过使用 git --no-pager log 来获得预期的行为,但是如果我想要使用传呼机?

解决方案

只需添加几个元素:

msysgit已经在第29期讨论了替代控制台回到一年前(2009年年中: mintty ,但对于cygwin而言,捕获窗口I / O )。



问题369 提到了选项 git config pager.log off 以禁用log的分页,这对于某些类似于该操作提及。



现在正在讨论类似的问题(2010年5月) issue 484 (通过 SO user kusma ,他在评论中指出:))


我可以重现这一点,但我不认为这是一个问题与git本身。这是
传呼机;在msys上少了一些严重的问题。一些较少的实验表明,
的罪魁祸首似乎是-R标志:



  $ git --no-pager diff --color =总是HEAD〜1 TestSegmentedText.java |减-R 


It appears to insert less blank lines the closer I type the command to the bottom of the terminal window. If I type it at the top of the terminal window, it inserts nearly a full window height of blank lines; if I type it at the very bottom, no blank lines are inserted.

It seems like the pager program is pushing output to the bottom of the terminal window, but I want the output to be right below my command or at the top, like in Linux git.

I can get expected behavior by using git --no-pager log, but what if I want to use a pager?

解决方案

Just to add a few elements:

msysgit was already discussing alternative consoles in issue 29 back a year ago (mid-2009: mintty, but for cygwin only, a capturing window I/O).

The issue 369 mentions the option "git config pager.log off" to disable paging for "log", which can come in handy for certain scenario similar to the one the OP mentions.

A similar problem is being discussed right now (May 2010) in issue 484 (by none other than SO user kusma as he points out in the comments ;) )

I can reproduce this, but I don't think it's an issue with git itself. It's the pager; less on msys has some serious issues. Some experiments with less shows that the culprit seems to be the -R flag:

$ git --no-pager diff --color=always HEAD~1 TestSegmentedText.java | less -R

这篇关于msysGit:为什么git log输出空行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆