Thomas Rast <trast@xxxxxxxxxxxxxxx> writes: > Word regexes are a bit of a dangerous beast, since it is easily > possible to not match a non-space part, which is subsequently ignored > for the purposes of emitting the word diff. This was clearly stated > in the docs, but users still tripped over it. > > Implement a safeguard that verifies two basic sanity assumptions: > > * The word regex matches anything that is !isspace(). > > * The word regex does not match '\n'. (This case is not very harmful, > but we used to silently cut off at the '\n' which may go against > user expectations.) > > This is configurable via 'diff.wordRegexCheck', and defaults to > 'warn'. How expensive to run this check twice, every time word_regex finds a match? As this is about making sure that we got a sane regex from the user (or a builtin pattern), I wonder if we can make it not depend on the payload we are matching the regex against. Then before using a word_regex that we have not checked, we check if that regex is sane, mark it checked, and do not have to do the check over and over again. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html