summaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-02-11 13:42:39 -0800
committerJunio C Hamano <gitster@pobox.com>2015-02-11 13:42:39 -0800
commit1ba6e860b9589b237502f78c77059d6392f76fd8 (patch)
tree6b78a92fd8b2e5dce0178be33b9054ca58f16d2b /revision.c
parentb19aab58f1bc44e9a6715f26ba32b8c9cda3b1fa (diff)
parent22dfa8a23de4bbb274027736edd3bd311dda2981 (diff)
downloadgit-1ba6e860b9589b237502f78c77059d6392f76fd8.tar.gz
Merge branch 'cj/log-invert-grep'
"git log --invert-grep --grep=WIP" will show only commits that do not have the string "WIP" in their messages. * cj/log-invert-grep: log: teach --invert-grep option
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/revision.c b/revision.c
index 86406a26a2..4bc851c070 100644
--- a/revision.c
+++ b/revision.c
@@ -2017,6 +2017,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, "--invert-grep")) {
+ revs->invert_grep = 1;
} else if ((argcount = parse_long_opt("encoding", argv, &optarg))) {
if (strcmp(optarg, "none"))
git_log_output_encoding = xstrdup(optarg);
@@ -2915,7 +2917,7 @@ static int commit_match(struct commit *commit, struct rev_info *opt)
(char *)message, strlen(message));
strbuf_release(&buf);
unuse_commit_buffer(commit, message);
- return retval;
+ return opt->invert_grep ? !retval : retval;
}
static inline int want_ancestry(const struct rev_info *revs)