git log: avoid segfault with --all-match
PATCH 1/1 git log: avoid segfault with --all-match
Avoid a segfault when the command
git log --all-match
was issued.
Signed-off-by Michele Ballabio <[email protected]>
---
Not sure if this is the right fix, nor if it would be better a warning or an error.
grep.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
grep.c +2 -1
@@ -190,7 +190,8 @@ void compile_grep_patterns(struct grep_opt *opt)* A classic recursive descent parser would do. */ p = opt->pattern_list; - opt->pattern_expression =compile_pattern_expr (&p); +if (p) + opt->pattern_expression =compile_pattern_expr (&p);if (p)die ("incomplete pattern expression: %s" , p->pattern); }
Signature · 1 line
1.6.2.22.gc2ac
Quoted 11 lines · Michele Ballabio
Avoid a segfault when the command
git log --all-matchwas issued.
Signed-off-by Michele Ballabio <[email protected]>---
Not sure if this is the right fix, nor if it would be better a warning or an error.
I think ignoring it makes sense; you could alias "git log --all-match" to something like "git lg", and when no grepping option appears it will still work.
I'd add s/was issued./was issued, by ignoring the option/; or something like that, though.
PATCH v2 1/1 git log: avoid segfault with --all-match
Avoid a segfault when the command
git log --all-match
was issued, by ignoring the option.
Signed-off-by Michele Ballabio <[email protected]>
--- grep.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
grep.c +2 -1
@@ -190,7 +190,8 @@ void compile_grep_patterns(struct grep_opt *opt)* A classic recursive descent parser would do. */ p = opt->pattern_list; - opt->pattern_expression =compile_pattern_expr (&p); +if (p) + opt->pattern_expression =compile_pattern_expr (&p);if (p)die ("incomplete pattern expression: %s" , p->pattern); }
Signature · 1 line
1.6.2.22.gc2ac