hooks: truly find ourselves
commit1dbb300ded46de220fe36e25c00cca2b5b613638
authorKyle J. McKay <mackyle@gmail.com>
Wed, 28 Feb 2018 02:21:32 +0000 (27 18:21 -0800)
committerKyle J. McKay <mackyle@gmail.com>
Wed, 28 Feb 2018 02:21:32 +0000 (27 18:21 -0800)
treec554ebc257e99b2ff873f69d79ed097189531176
parent717145346113acd4696766ca882dda1ee4402d14
hooks: truly find ourselves

With hooks possibly running as a result of non-Girocco activity
(e.g. a linked working tree), the possible combinations of GIT_DIR
settings, ".git" being a directory, symlink or "gitdir:" file and
a veritable plethora of possible current working directories create
a truly perverse and potentially hostile hook script environment.

The hook scripts attempt to navigate this maze of possibilities
without requiring any particular Git version while still operating
correctly when executed from within a chroot jail and yet always
ending up with the current directory and GIT_DIR pointing at the
"top" of the "bare" ".git" Girocco repository.

Enhance the logic substantially (at almost no additional cost) to
handle all (hopefully) of the bizarre situations a hook script could
find itself being executed in.

The previous version worked just fine for ordinary Girocco installations
that do not have any linked working trees or non-bare repositories.

This version tolerates much greater perversity while still always
coming out on top.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
hooks/post-commit
hooks/post-receive
hooks/pre-auto-gc
hooks/pre-receive
hooks/update