gnustavo / Git-Hooks

Framework for implementing Git (and Gerrit) hooks
http://search.cpan.org/dist/Git-Hooks/
41 stars 17 forks source link

Support Extended Regular Expressions in Config Vars #65

Open mikkoi opened 4 years ago

mikkoi commented 4 years ago

How could we support extended regular expressions in configuration instead of the more limited standard Perl regex? Add "/x" to the end of the config var string?

This would be useful because extended regex is often more readable.

gnustavo commented 4 years ago

You mean the POSIX Extended Regular Expressions are more powerful than Perl's? I don't think so.

Please, can you show me some examples to make it clearer?

mikkoi commented 4 years ago

It's not POSIX I'm after but more whitespace with the /x and /xx Perl modifiers. This is especially important with Git config limitations, all those double backslases, "\\".

https://perldoc.perl.org/perlre.html#Details-on-some-modifiers

gnustavo commented 4 years ago

Ah, now I get it.

This is a good idea. The way Git::Hooks treat options that may have regexes as values it totally ad-hoc. I think there should be a method in Git::Repository::Plugin::GitHooks responsible for grokking such values so that every plugin could use it. This way we would be able to have more consistency and also to make improvements in a single spot.

I'll have to take some time to think about it.