aboutsummaryrefslogtreecommitdiff
path: root/Documentation/git-grep.txt
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2010-06-12 11:36:51 -0500
committerJunio C Hamano <gitster@pobox.com>2010-06-13 09:16:38 -0700
commit678e484b7d4e6388edeec3470bbbcd206817c148 (patch)
tree27f426c9db30f349d54e56cb28ee91c37ef2a050 /Documentation/git-grep.txt
parent685359cf2d1996aed2f1b1e2857528819d27105d (diff)
downloadgit-678e484b7d4e6388edeec3470bbbcd206817c148.tar.gz
git-678e484b7d4e6388edeec3470bbbcd206817c148.tar.xz
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. [jn: rebased and added tests; with error handling fix from Junio squashed in] Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/git-grep.txt')
-rw-r--r--Documentation/git-grep.txt8
1 files changed, 8 insertions, 0 deletions
diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt
index 4b32322a6..8fdd8e1e4 100644
--- a/Documentation/git-grep.txt
+++ b/Documentation/git-grep.txt
@@ -14,6 +14,7 @@ SYNOPSIS
[-E | --extended-regexp] [-G | --basic-regexp]
[-F | --fixed-strings] [-n]
[-l | --files-with-matches] [-L | --files-without-match]
+ [-O | --open-files-in-pager]
[-z | --null]
[-c | --count] [--all-match] [-q | --quiet]
[--max-depth <depth>]
@@ -104,6 +105,13 @@ OPTIONS
For better compatibility with 'git diff', `--name-only` is a
synonym for `--files-with-matches`.
+-O::
+--open-files-in-pager::
+ Open the matching files in the pager (not the output of 'grep').
+ If the pager happens to be "less" or "vi", and the user
+ specified only one pattern, the first file is positioned at
+ the first match automatically.
+
-z::
--null::
Output \0 instead of the character that normally follows a