Improved directory management in git hooks

* Make git hooks always execute utilities relative to git repository root
* And make them fail if called from outside the git repository
* Make utilities save current directory and return after doing their
  things