; Use $GIT_DIR to find the .git directory inside our hooks

This resolves an issue with running the hooks from a worktree.  See
<https://lists.gnu.org/archive/html/emacs-devel/2023-05/msg00000.html>.

* build-aux/git-hooks/post-commit:
* build-aux/git-hooks/pre-push: Use $GIT_DIR.
This commit is contained in:
Jim Porter 2023-05-01 09:49:39 -07:00
parent aa135e09b6
commit d01543f114
2 changed files with 2 additions and 2 deletions

View file

@ -42,4 +42,4 @@ else
fi
git rev-parse HEAD | $awk -v reason=post-commit \
-f .git/hooks/commit-msg-files.awk
-f ${GIT_DIR:-.git}/hooks/commit-msg-files.awk

View file

@ -83,4 +83,4 @@ $awk -v origin_name="$1" '
# Print every SHA after oldref, up to (and including) newref.
system("git rev-list --first-parent --reverse " oldref ".." newref)
}
' | $awk -v reason=pre-push -f .git/hooks/commit-msg-files.awk
' | $awk -v reason=pre-push -f ${GIT_DIR:-.git}/hooks/commit-msg-files.awk