diff --git a/bin/commitlint.sh b/bin/commitlint.sh index 9bc13e6..b250e23 100755 --- a/bin/commitlint.sh +++ b/bin/commitlint.sh @@ -2,8 +2,10 @@ ARGS="--config /work/commitlint.config.js" -if [ "$1" == ".git/COMMIT_EDITMSG" ]; then - # Running from pre-commit hook. +if [[ "$1" == *COMMIT_EDITMSG ]]; then + # Running from pre-commit hook. Git passes a relative path from the main + # checkout (.git/COMMIT_EDITMSG) and an absolute path from a worktree + # (.../.git/worktrees//COMMIT_EDITMSG). ARGS="$ARGS --edit $1" else # Use whatever args we were passed.