From 1f66853b6844cb9773de3ed49476d78a6b1df6b6 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Thu, 2 May 2024 10:15:22 -0400 Subject: [PATCH] Fix pre-commit script to support Git worktrees Signed-off-by: Timothy Johnson --- .husky/commit-msg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.husky/commit-msg b/.husky/commit-msg index 0650dbb76c..588cd05acf 100755 --- a/.husky/commit-msg +++ b/.husky/commit-msg @@ -2,7 +2,7 @@ . "$(dirname "$0")/_/husky.sh" # If not a merge commit, require commit to be signed off -if [ ! -e .git/MERGE_MSG ] && ! grep -q "^Signed-off-by: " "$1"; then +if [ ! -e $(git rev-parse --git-dir)/MERGE_MSG ] && ! grep -q "^Signed-off-by: " "$1"; then echo >&2 "Commit message must be signed off with your user name and email." echo >&2 "To sign off your commit, add the -s flag to the git commit command." exit 1