Note: Regarding those patterns, Git 2.34 (Q4 2021), is clearer and reminds developers that the userdiff
patterns should be kept simple and permissive, assuming that the contents they apply are always syntactically correct.
See commit b6029b3 (10 Aug 2021) by Junio C Hamano (gitster
).
(Merged by Junio C Hamano -- gitster
-- in commit e1eb133, 30 Aug 2021)
userdiff
: comment on the builtin patterns
Remind developers that they do not need to go overboard to implement patterns to prepare for invalid constructs.
They only have to be sufficiently permissive, assuming that the payload is syntactically correct, and that may allow them to be simpler.
Text stolen mostly from, and further improved by, Johannes Sixt.
So those built-in patterns now have as a comment:
/*
* Built-in drivers for various languages, sorted by their names
* (except that the "default" is left at the end).
*
* When writing or updating patterns, assume that the contents these
* patterns are applied to are syntactically correct. The patterns
* can be simple without implementing all syntactical corner cases, as
* long as they are sufficiently permissive.
*/
static struct userdiff_driver builtin_drivers[] = {