diff options
author | Christoph Junghans <ottxor@gentoo.org> | 2015-01-13 02:33:32 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-01-13 19:20:32 +0100 |
commit | 22dfa8a23de4bbb274027736edd3bd311dda2981 (patch) | |
tree | 98607b458d72d693ed6ee33005d785c05b7b7bc6 /t/t4202-log.sh | |
parent | Merge branch 'maint-2.0' into maint-2.1 (diff) | |
download | git-22dfa8a23de4bbb274027736edd3bd311dda2981.tar.xz git-22dfa8a23de4bbb274027736edd3bd311dda2981.zip |
log: teach --invert-grep option
"git log --grep=<string>" shows only commits with messages that
match the given string, but sometimes it is useful to be able to
show only commits that do *not* have certain messages (e.g. "show
me ones that are not FIXUP commits").
Originally, we had the invert-grep flag in grep_opt, but because
"git grep --invert-grep" does not make sense except in conjunction
with "--files-with-matches", which is already covered by
"--files-without-matches", it was moved it to revisions structure.
To have the flag there expresses the function to the feature better.
When the newly inserted two tests run, the history would have commits
with messages "initial", "second", "third", "fourth", "fifth", "sixth"
and "Second", committed in this order. The commits that does not match
either "th" or "Sec" is "second" and "initial". For the case insensitive
case only "initial" matches.
Signed-off-by: Christoph Junghans <ottxor@gentoo.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4202-log.sh')
-rwxr-xr-x | t/t4202-log.sh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/t/t4202-log.sh b/t/t4202-log.sh index 99ab7ca21f..5f2b290d2b 100755 --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@ -212,6 +212,21 @@ test_expect_success 'log --grep' ' test_cmp expect actual ' +cat > expect << EOF +second +initial +EOF +test_expect_success 'log --invert-grep --grep' ' + git log --pretty="tformat:%s" --invert-grep --grep=th --grep=Sec >actual && + test_cmp expect actual +' + +test_expect_success 'log --invert-grep --grep -i' ' + echo initial >expect && + git log --pretty="tformat:%s" --invert-grep -i --grep=th --grep=Sec >actual && + test_cmp expect actual +' + test_expect_success 'log --grep option parsing' ' echo second >expect && git log -1 --pretty="tformat:%s" --grep sec >actual && |