Support git worktrees
The fix for #103 (closed) is fairly trivial: replace $(dirname "$0")/.git
with $(git rev-parse --absolute-git-dir)
. In the main repo directory the latter is equivalent to the former (except that it works from anywhere inside the repo, not just from the top directory). As for git worktrees, git rev-parse --absolute-git-dir
points to the worktree's git directory, which is located at .git/worktrees/$WORKTREE_NAME/
, where .git
is the main repo's git directory. Hooks will be created there and should work just as if they were created for the main repo directory. However, I haven't tested the full functionality of debcargo-conf within a git worktree, just that the pre-commit hook is created correctly and that I'm able to do parallel builds from separate git worktrees.