Skip to content

Commit 07417d1

Browse files
committed
add .git to regex to get git project root from worktree directory
1 parent d65a692 commit 07417d1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

simple-git-hooks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function getGitProjectRoot(directory=process.cwd()) {
5959
if (fs.existsSync(fullPath)) {
6060
if(!fs.lstatSync(fullPath).isDirectory()) {
6161
let content = fs.readFileSync(fullPath, { encoding: 'utf-8' })
62-
let match = /^gitdir: (.*)\s*$/.exec(content)
62+
let match = /^gitdir: (.*\.git)((\/.*)|(\s*))/.exec(content)
6363
if (match) {
6464
return path.normalize(match[1])
6565
}

0 commit comments

Comments
 (0)