hooks: work around worktree wierdness
commit85805ebf8e131b7f21f3d764690f825f167a3653
authorKyle J. McKay <mackyle@gmail.com>
Fri, 22 Dec 2017 04:53:20 +0000 (21 20:53 -0800)
committerKyle J. McKay <mackyle@gmail.com>
Fri, 22 Dec 2017 04:53:20 +0000 (21 20:53 -0800)
tree3220fa215eb7d15e24b40728453bed47ec2907a4
parent2b778cce139f2d8b98897f48af64cbcfb5586bea
hooks: work around worktree wierdness

Girocco has recently started "tolerating" linked working trees
(and perhaps even non-bare repositories) just a bit better.

Unfortunately that means the situation gets inflicted on the
hook scripts as well.

While the receive scripts are generally not expected to have
to deal with the current working directory being a worktree
rather than an actual Git repository directory, linked working
trees introduce bizarre wierdness.

One _can_ clone a linked working tree and then push back into
it.  Ugh.  The receive hook scripts get all kinds of wierd
things when this happens.  Of particular concern, the current
working directory will _not_ be the directory containing the
`config` file!

Address this travesty by resetting the current working directory
and GIT_DIR variable when the ugly situation rears its head so
that the hook scripts work like they are designed to.

And just in case, also make sure the current directory has not
been left pointing at some worktree somewhere.

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