Merge branch 'rs/grep-parser-fix'
"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
This commit is contained in:
2
grep.c
2
grep.c
@ -657,6 +657,8 @@ static struct grep_expr *compile_pattern_and(struct grep_pat **list)
|
||||
x = compile_pattern_not(list);
|
||||
p = *list;
|
||||
if (p && p->token == GREP_AND) {
|
||||
if (!x)
|
||||
die("--and not preceded by pattern expression");
|
||||
if (!p->next)
|
||||
die("--and not followed by pattern expression");
|
||||
*list = p->next;
|
||||
|
Reference in New Issue
Block a user