git grep output is buffered. Why?

I run git grep for the first time on a large tree (the Linux kernel).

This takes a long time to run. If I cancel with ctrl+C before it finishes, often it immediately shows a line it found.

Why did git grep not show the line immediately, when it found it?


$ rpm -q git
git-2.17.2-1.fc28.x86_64

Answer

git grep output is buffered by less. (In most cases. It can be changed using various configuration options, if you need to).

The reason I did not notice this, is that git grep does not show the less pager footer when there is less than one screen of output. However, the output is still buffered. (I can see that less is running, by opening another terminal and running ps -ax).

Attribution
Source : Link , Question Author : sourcejedi , Answer Author : sourcejedi

Leave a Comment