summaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorChristoph Junghans <ottxor@gentoo.org>2015-01-03 22:27:48 -0700
committerJunio C Hamano <gitster@pobox.com>2015-01-06 14:40:46 -0800
commita462402232aab7f44c46c614ac9c3d94c65b3831 (patch)
tree85a07d33076d743a7767f8524cd5eaddf74e9577 /revision.c
parentc2e8e4b9da4d007b15faa2e3d407b2fd279f0572 (diff)
downloadgit-cj/grep-none-match.tar.gz
git-log: added --none-match optioncj/grep-none-match
Implements a inverted match for "git log", like in the case of "git grep -v", which is useful from time to time to e.g. filter FIXUP message out of "git log". Internally, a new bol 'none_match' has been introduces as revs->grep_filter.invert inverts the match line-wise, which cannot work as i.e. empty line always not match the pattern given. Signed-off-by: Christoph Junghans <ottxor@gentoo.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/revision.c b/revision.c
index 75dda928ea..d43779e6ce 100644
--- a/revision.c
+++ b/revision.c
@@ -2011,6 +2011,8 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
grep_set_pattern_type_option(GREP_PATTERN_TYPE_PCRE, &revs->grep_filter);
} else if (!strcmp(arg, "--all-match")) {
revs->grep_filter.all_match = 1;
+ } else if (!strcmp(arg, "--none-match")) {
+ revs->grep_filter.none_match = 1;
} else if ((argcount = parse_long_opt("encoding", argv, &optarg))) {
if (strcmp(optarg, "none"))
git_log_output_encoding = xstrdup(optarg);
@@ -2333,6 +2335,8 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
die("cannot combine --walk-reflogs with --graph");
if (!revs->reflog_info && revs->grep_filter.use_reflog_filter)
die("cannot use --grep-reflog without --walk-reflogs");
+ if (revs->grep_filter.all_match && revs->grep_filter.none_match)
+ die("cannot combine --all-match with --none-match");
return left;
}