grep: Add the option '--open-files-in-pager'
commit55c5806414572bfe9592de67ea3f9472e41bac99
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Thu, 23 Apr 2009 10:50:22 +0000 (23 12:50 +0200)
committerJohannes Schindelin <johannes.schindelin@gmx.de>
Fri, 11 Jun 2010 14:20:04 +0000 (11 16:20 +0200)
treed0c7d45dded3942f8dd6eae8a8e4add03c9fb647
parent72a39dc03cc09fbcf0042f3ac6fe95cc9a4a8cc4
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