hooks: get out of the mob for free
commit874ff9266fe1c2c6c1b77a2c093369c6ff4a2f5c
authorKyle J. McKay <mackyle@gmail.com>
Fri, 22 Dec 2017 23:06:09 +0000 (22 15:06 -0800)
committerKyle J. McKay <mackyle@gmail.com>
Fri, 22 Dec 2017 23:06:09 +0000 (22 15:06 -0800)
treee11b0a8fd24776f97738bbc9f53e7143d594883d
parent94c9ff11b22094a387053d999768074500b179a1
hooks: get out of the mob for free

When a push project is created a "personal" mob pseudo-repository
also gets made in the repository.  This provides the convenient
illusion to personal-mob-only pushers that their personal mob
branch(es) lie underneath refs/heads somewhere.

This pseudo-repository mostly consists of symlinks to the real
repository except for a few real directories underneath "refs" in
order to provide the namespace illusion.

The update hook script has a special test to see if it's being run
as a result of a personal mob push, but the exact same hook script
gets used by both the personal mob and the real repository.

The pre-receive and post-receive scripts, however, are little stub
scripts that just change the current directory and the setting of
GIT_DIR and then exec the same-named hooks in the real repository.

This is clumsy.

Make the real pre-receive and post-receive scripts "personal" mob
aware so they can be used directly by either the personal mob pseudo
repository or the real repository.

Now that the stub scripts are no longer necessary, get rid of them
and replace the "hooks" directory in the pseudo repository with a
symbolic link to the "hooks" directory in the real repository.

This is much simpler, more efficient and much easier to maintain.

As a bonus update-all-hooks also runs faster.

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