3

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?

skaffman
  • 398,947
  • 96
  • 818
  • 769
xofz
  • 5,600
  • 6
  • 45
  • 63
  • Could that just be an artifact of the pager or terminal in windows? (The pager is definitely being invoked, right?) – Cascabel May 24 '10 at 18:18
  • As far as I know, yes. The output is different if I use --no-pager. msysGit has a less.exe in its bin\ folder, yet it seems to be acting differently from the Linux version of `less` (if that's the pager being invoked). – xofz May 24 '10 at 18:35

2 Answers2

3

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
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks for quoting me ;) Anyway, yes. It's definitely worth checking out if less -R is the culprit in this case also. If so, we expect to have a fix in 'devel' soon. – kusma May 25 '10 at 16:47
  • @kusma: Hi Kusma! I didn't realize you were also a SO user :) I have edited the answer to add the proper attribution. – VonC May 25 '10 at 17:30
1

That's the behavior of the pager. By default, Git output is piped through a paper that behaves the way you describe. (You could try to find another pager that acts like you want, and use that as your pager instead.)

mipadi
  • 398,885
  • 90
  • 523
  • 479
  • This doesn't seem to be the case in Linux - for example, I can use `git log --grep=...` with a pattern that matches only one commit, and it appears to invoke the pager (I get the (END) and have to press q) but doesn't consume the whole terminal. Not actually sure how that works, to be honest. – Cascabel May 24 '10 at 18:22