[dunecontrol] Make git hook directory lookup more robust
The current lookup does not work correctly in the presence of worktrees, so try to use git for the lookup, but fall back to the old code if git is to old or the git executable cannot be found.
This supercedes the partial fix in !298 (closed).
Edited by Steffen Müthing