From c24b418c323b2e6d3babc9bb5161edf3eb7840e6 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Mon, 30 Mar 2026 15:27:10 +0200 Subject: [PATCH] build: support git worktrees in verifyCommit script --- scripts/verifyCommit.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/verifyCommit.mjs b/scripts/verifyCommit.mjs index 6c1bcb3ab..3fe405848 100644 --- a/scripts/verifyCommit.mjs +++ b/scripts/verifyCommit.mjs @@ -1,10 +1,12 @@ // Invoked on the commit-msg git hook by simple-git-hooks. import chalk from 'chalk' +import { execSync } from 'node:child_process' import { readFileSync } from 'node:fs' import path from 'node:path' -const msgPath = path.resolve('.git/COMMIT_EDITMSG') +const gitDir = execSync('git rev-parse --git-dir', { encoding: 'utf-8' }).trim() +const msgPath = path.resolve(gitDir, 'COMMIT_EDITMSG') const msg = readFileSync(msgPath, 'utf-8').trim() const commitRE = -- 2.47.3