ref-filter: reject arguments to %(HEAD)
The %(HEAD) atom doesn't take any arguments, but unlike other atoms in the same boat (objecttype, deltabase, etc), it does not detect this situation and complain. Let's make it consistent with the others. Signed-off-by: Jeff King <peff@peff.net> Acked-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Dec 14, 2022 at 11:18 UTC
afc1a946b256a54ba4abf530f0a720393aad461e
1 file changed
+3
-1
ref-filter.c
+3
-1
@@ -571,8 +571,10 @@ static int rest_atom_parser(struct ref_format *format, struct used_atom *atom,
571
}
572
573
static int head_atom_parser(struct ref_format *format, struct used_atom *atom,
574
- const char *arg, struct strbuf *unused_err)
574
+ const char *arg, struct strbuf *err)
575
{
576
+ if (arg)
577
+ return strbuf_addf_ret(err, -1, _("%%(HEAD) does not take arguments"));
578
atom->u.head = resolve_refdup("HEAD", RESOLVE_REF_READING, NULL, NULL);
579
return 0;
580
}