]> git.ipfire.org Git - thirdparty/git.git/commit
ref-filter: factor out "%(foo) does not take arguments" errors
authorJeff King <peff@peff.net>
Wed, 14 Dec 2022 16:19:43 +0000 (11:19 -0500)
committerJunio C Hamano <gitster@pobox.com>
Thu, 15 Dec 2022 00:13:56 +0000 (09:13 +0900)
commita33d0fae76ab95e88d383793cac41934920296ba
tree9c1dc67fa3d9938315d663d5629b87b71a89e560
parentafc1a946b256a54ba4abf530f0a720393aad461e
ref-filter: factor out "%(foo) does not take arguments" errors

Many atom parsers give the same error message, differing only in the
name of the atom. If we use "%s does not take arguments", that should
make life easier for translators, as they only need to translate one
string. And in doing so, we can easily pull it into a helper function to
make sure they are all using the exact same string.

I've added a basic test here for %(HEAD), just to make sure this code is
exercised at all in the test suite. We could cover each such atom, but
the effort-to-reward ratio of trying to maintain an exhaustive list
doesn't seem worth it.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
ref-filter.c
t/t6300-for-each-ref.sh