summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2019-07-25 14:27:08 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-07-25 14:27:08 -0700
commit518e8748979dbe485f519d0f63c3642cc1643f79 (patch)
treefaabd0748cbacbfc92946209e5aeceb9a20884d3
parentMerge branch 'ds/object-info-for-prefetch-fix' into maint (diff)
parentgrep: fail if call could output and name is null (diff)
downloadtgif-518e8748979dbe485f519d0f63c3642cc1643f79.tar.xz
Merge branch 'es/grep-require-name-when-needed' into maint
More parameter validation. * es/grep-require-name-when-needed: grep: fail if call could output and name is null
-rw-r--r--grep.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/grep.c b/grep.c
index 0d50598acd..f7c3a5803e 100644
--- a/grep.c
+++ b/grep.c
@@ -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;