hooks: find ourselves before seeking elsewhere
commitd8aa56ace831bcb018e55b38248e424179988614
authorKyle J. McKay <mackyle@gmail.com>
Fri, 22 Dec 2017 08:01:25 +0000 (22 00:01 -0800)
committerKyle J. McKay <mackyle@gmail.com>
Fri, 22 Dec 2017 08:01:25 +0000 (22 00:01 -0800)
tree4963702fe9d921674f32a0a53b6f3f7926f60c84
parent85805ebf8e131b7f21f3d764690f825f167a3653
hooks: find ourselves before seeking elsewhere

Two of the mob hook scripts simply redirect to the same-named hook
scripts in the non-mob repository (pre-receive and post-receive).

They have been assuming that the script to hand off to (via exec)
can be found in the $PWD/../hooks directory.

But now, with the hand of friendship (reluctant tolerance) extended
to linked working trees, all sorts of wierd **** can happen.

Instead of relying on the value of the current working directory,
use the actual script's location (as determined using a combination
of the current working directory and $0) as the starting point to
locate the script to hand off to.

Since the scripts themselves will always be in the same location
no matter what kind of repository (bare, non-bare, main working
tree, linked working tree, local, remote) is involved, this provides
a much more reliable technique that works for every access method.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
bin/create-personal-mob-area
toolbox/update-all-hooks.sh