Skip to content

Commit

Permalink
Merge branch 'es/grep-require-name-when-needed' into maint
Browse files Browse the repository at this point in the history
More parameter validation.

* es/grep-require-name-when-needed:
  grep: fail if call could output and name is null
  • Loading branch information
gitster committed Jul 25, 2019
2 parents 90891c6 + de99eb0 commit 518e874
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions grep.c
Original file line number Diff line number Diff line change
Expand Up @@ -1780,6 +1780,10 @@ static int grep_source_1(struct grep_opt *opt, struct grep_source *gs, int colle
enum grep_context ctx = GREP_CONTEXT_HEAD;
xdemitconf_t xecfg;

if (!opt->status_only && gs->name == NULL)
BUG("grep call which could print a name requires "
"grep_source.name be non-NULL");

if (!opt->output)
opt->output = std_output;

Expand Down

0 comments on commit 518e874

Please sign in to comment.