summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-06-17 10:15:14 -0700
committerJunio C Hamano <gitster@pobox.com>2019-06-17 10:15:14 -0700
commitac97dc4fa9869146f774f6df854e23afb38e15cd (patch)
treebd3bcb0d59d91617c8764834547d6dd3e0b8cbdd
parent7df94cd1f691dd6ccb3038e1b77544030aab3fed (diff)
parentde99eb0c24d96730de187edd37b9ca9d42b0b05d (diff)
downloadgit-ac97dc4fa9869146f774f6df854e23afb38e15cd.tar.gz
Merge branch 'es/grep-require-name-when-needed'
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;