]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'rs/grep-parser-fix'
authorJunio C Hamano <gitster@pobox.com>
Tue, 13 Jul 2021 23:52:53 +0000 (16:52 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 13 Jul 2021 23:52:53 +0000 (16:52 -0700)
"git grep --and -e foo" ought to have been diagnosed as an error
but instead segfaulted, which has been corrected.

* rs/grep-parser-fix:
  grep: report missing left operand of --and

1  2 
grep.c
t/t7810-grep.sh

diff --cc grep.c
Simple merge
diff --cc t/t7810-grep.sh
index 5830733f3d25be77cc4318e76d9c30695d4adbd0,47434e668713ab5c8b37e5a23513c7eea142fc7a..6b6423a07c3a6e0b497e3fbd109679b38dbe3856
@@@ -6,11 -6,15 +6,18 @@@
  test_description='git grep various.
  '
  
 +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 +
  . ./test-lib.sh
  
+ test_invalid_grep_expression() {
+       params="$@" &&
+       test_expect_success "invalid expression: grep $params" '
+               test_must_fail git grep $params -- nonexisting
+       '
+ }
  cat >hello.c <<EOF
  #include <assert.h>
  #include <stdio.h>