diff options
author | Carlos López <00xc@protonmail.com> | 2022-06-22 21:47:32 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-06-22 22:23:29 +0200 |
commit | 68437ede53dccd1dea9e44e831a59de274d389de (patch) | |
tree | 4522d5e4501a87bd71ed5d0d0a3e7e1dd76b3cb7 /Documentation | |
parent | Git 2.37-rc2 (diff) | |
download | git-68437ede53dccd1dea9e44e831a59de274d389de.tar.xz git-68437ede53dccd1dea9e44e831a59de274d389de.zip |
grep: add --max-count command line option
This patch adds a command line option analogous to that of GNU
grep(1)'s -m / --max-count, which users might already be used to.
This makes it possible to limit the amount of matches shown in the
output while keeping the functionality of other options such as -C
(show code context) or -p (show containing function), which would be
difficult to do with a shell pipeline (e.g. head(1)).
Signed-off-by: Carlos López 00xc@protonmail.com
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/git-grep.txt | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt index 3d393fbac1..58d944bd57 100644 --- a/Documentation/git-grep.txt +++ b/Documentation/git-grep.txt @@ -23,6 +23,7 @@ SYNOPSIS [--break] [--heading] [-p | --show-function] [-A <post-context>] [-B <pre-context>] [-C <context>] [-W | --function-context] + [(-m | --max-count) <num>] [--threads <num>] [-f <file>] [-e] <pattern> [--and|--or|--not|(|)|-e <pattern>...] @@ -238,6 +239,14 @@ providing this option will cause it to die. `git diff` works out patch hunk headers (see 'Defining a custom hunk-header' in linkgit:gitattributes[5]). +-m <num>:: +--max-count <num>:: + Limit the amount of matches per file. When using the `-v` or + `--invert-match` option, the search stops after the specified + number of non-matches. A value of -1 will return unlimited + results (the default). A value of 0 will exit immediately with + a non-zero status. + --threads <num>:: Number of grep worker threads to use. See `grep.threads` in 'CONFIGURATION' for more information. |