]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
build: support git worktrees in verifyCommit script main
authorEduardo San Martin Morote <posva13@gmail.com>
Mon, 30 Mar 2026 13:27:10 +0000 (15:27 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 30 Mar 2026 13:29:41 +0000 (15:29 +0200)
scripts/verifyCommit.mjs

index 6c1bcb3ab8b6dc91ea8f01c9565f6b4b5ed7333c..3fe405848a53b4dbe86ec14b31d9ed6c0f982820 100644 (file)
@@ -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 =