Git-Hooks
Git-Hooks copied to clipboard
Support a versioned git-hooks.config file
Normally, only the Git server administrator can edit the configuration files needed to configure Git::Hooks for server hooks, because the files reside in the server.
It would be nice if the configuration could be extended by a file versioned in the repository. For example, a file called git-hooks.config
at the repository root. The fact that the file can be different in different branches is a plus.
The idea is that the configuration in this file should take precedence over the configuration taken from the standard Git repository configuration files.
However, not every configuration option should be settable in this file. There are dangerous global options, such as the githooks.plugin
, the githooks.disable
, and the githooks.admin
. There are also some dangerous plugin options, such as the githooks.checkfile.name
and the githooks.checkcommit.check-code
.
But there are several options that are harmless, such as githooks.checkfile.deny-token
, githooks.checkcommit.push-limit
, and githooks.checklog.title-period
. Even the githooks.checkref.acl
and the githooks.checkfile.acl
options are safe in the sense that they can't cause damage. One can even use the githooks.checkfile.acl
option to restrict who can commit changes to the git-hooks.config
file in the repository.
I think we need a new method called, perhaps, get_config_harmless(), which should be used to grok harmless options. The dangerous ones should continue to be grokked with the git_config() method.