grep: Add the option '--open-files-in-pager'
commit6a5eac6a3150eb6bd650ea1eda0c24d273660ccc
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Thu, 23 Apr 2009 10:50:22 +0000 (23 12:50 +0200)
committerJohannes Schindelin <johannes.schindelin@gmx.de>
Mon, 12 Apr 2010 12:56:21 +0000 (12 14:56 +0200)
treea88fd7e8deee12f76629511454059885624b21e9
parente1a0ad012be06b3b1ae7a22b541de6a4bc991fae
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