Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/grep.h
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2021-12-17 19:48:49 +0300
committerJunio C Hamano <gitster@pobox.com>2021-12-18 01:13:08 +0300
commit794c000267b7bd29024b56e282509a82b31e6fc8 (patch)
treeb3461a00666e3b60104a5bfd0f8ea949f50beec9 /grep.h
parente9d7761bb94f20acc98824275e317fa82436c25d (diff)
log: let --invert-grep only invert --grep
The option --invert-grep is documented to filter out commits whose messages match the --grep filters. However, it also affects the header matches (--author, --committer), which is not intended. Move the handling of that option to grep.c, as only the code there can distinguish between matches in the header from those in the message body. If --invert-grep is given then enable extended expressions (not the regex type, we just need git grep's --not to work), negate the body patterns and check if any of them match by piggy-backing on the collect_hits mechanism of grep_source_1(). Collecting the matches in struct grep_opt is a bit iffy, but with "last_shown" we have a precedent for writing state information to that struct. Reported-by: Dotan Cohen <dotancohen@gmail.com> Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'grep.h')
-rw-r--r--grep.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/grep.h b/grep.h
index 3e8815c347..6a1f0ab017 100644
--- a/grep.h
+++ b/grep.h
@@ -148,6 +148,8 @@ struct grep_opt {
int word_regexp;
int fixed;
int all_match;
+ int no_body_match;
+ int body_hit;
#define GREP_BINARY_DEFAULT 0
#define GREP_BINARY_NOMATCH 1
#define GREP_BINARY_TEXT 2