Config.pm: add $localhooks knob
commitf754ec2321b4d1828c04c6a5c50104449b569dfc
authorKyle J. McKay <mackyle@gmail.com>
Sun, 31 Dec 2017 03:20:38 +0000 (30 19:20 -0800)
committerKyle J. McKay <mackyle@gmail.com>
Sun, 31 Dec 2017 03:20:38 +0000 (30 19:20 -0800)
tree03964e6f1eb27b021a208ca7d372c3f21e3d9218
parent37da5ae2e9b9b950692c5c741c8a2667592b6888
Config.pm: add $localhooks knob

Girocco requires the core.hooksPath config to be set in each and
every Girocco repository to an absolute path to compensate for the
abominable core.hooksPath implementation.

Because Girocco maintains symbolic links to the global hooks in
each repository's hooks subdirectory to allow use with older versions
of Git, Girocco will also tolerate core.hooksPath set to an absolute
path to the repository's own hooks directory.  This also has the
side-effect of permitting repository-specific hooks if desired.

By default Girocco prefers setting it to point at $reporoot/_global/hooks.

However, if the new $Girocco::Config::localhooks knob is set to
true then Girocco will instead prefer setting it to point at
$reporoot/<project_name>.git/hooks initially.

The $reporoot/_global/hooks setting tolerates moving the repository
around without losing hooks functionality whereas simply renaming a
repository with it pointing to the absolute path to the repository's
hooks subdirectory will disrupt hooks operation unless the setting
gets updated after renaming.

It's also a tad more efficient to point directly at _global/hooks
since no symbolic links need be traversed in that case.

For these reasons $Girocco::Config::localhooks remains set to
false by default.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
Girocco/Config.pm
Girocco/Project.pm
toolbox/update-all-config.pl