Skip to content

Commit e221875

Browse files
author
xiongjie
committed
feat: just get config hooksPath local
git config core.hooksPath will get the global config probably,and will overwrite hooks with setHooksFromConfig function,and this will affect the other project。
1 parent 2ad5514 commit e221875

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/cold-falcons-pick.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"simple-git-hooks": patch
3+
---
4+
5+
just get config hooksPath local

simple-git-hooks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ async function setHooksFromConfig(projectRootPath=process.cwd(), argv=process.ar
197197
function _getHooksDirPath(projectRoot) {
198198
const defaultHooksDirPath = path.join(projectRoot, '.git', 'hooks')
199199
try {
200-
const customHooksDirPath = execSync('git config core.hooksPath', {
200+
const customHooksDirPath = execSync('git config --local core.hooksPath', {
201201
cwd: projectRoot,
202202
encoding: 'utf8'
203203
}).trim()

0 commit comments

Comments
 (0)