grep: Add the option '--open-files-in-pager'
commit8e47f498ab4117d7f256f93d8d437dbbd4a999bb
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Thu, 23 Apr 2009 10:50:22 +0000 (23 12:50 +0200)
committerJohannes Schindelin <johannes.schindelin@gmx.de>
Tue, 30 Mar 2010 13:29:57 +0000 (30 15:29 +0200)
tree56427aeb5ab33417a687101b5bff53b817645e8c
parentd00d6559bb551fe6e1cd6543804f6a36cf2f6475
grep: Add the option '--open-files-in-pager'

This adds an option to open the matching files in the pager, and if the
pager happens to be "less" (or "vi") and there is only one grep pattern,
it also jumps to the first match right away.

The short option was chose as '-O' to avoid clashes with GNU grep's
options (as suggested by Junio).

So, 'git grep -O abc' is a short form for 'less +/abc $(grep -l abc)'
except that it works also with spaces in file names, and it does not
start the pager if there was no matching file.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Documentation/git-grep.txt
builtin/grep.c
git.c