You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: simple-git-hooks.js
+37-7
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
constfs=require('fs')
2
2
constpath=require('path')
3
3
consturl=require('url')
4
+
const{ execSync }=require('child_process');
4
5
5
6
constCONFIG_ERROR='[ERROR] Config was not found! Please add `.simple-git-hooks.cjs` or `.simple-git-hooks.js` or `.simple-git-hooks.mjs` or `simple-git-hooks.cjs` or `simple-git-hooks.js` or `simple-git-hooks.mjs` or `.simple-git-hooks.json` or `simple-git-hooks.json` or `simple-git-hooks` entry in package.json.\r\nCheck README for details'
6
7
@@ -185,7 +186,36 @@ async function setHooksFromConfig(projectRootPath=process.cwd(), argv=process.ar
185
186
}
186
187
187
188
/**
188
-
* Creates or replaces an existing executable script in .git/hooks/<hook> with provided command
189
+
* Returns the absolute path to the Git hooks directory.
190
+
* Respects user-defined core.hooksPath from Git config if present;
191
+
* otherwise defaults to <gitRoot>/.git/hooks.
192
+
*
193
+
* @param {string} gitRoot - The absolute path to the Git project root
194
+
* @returns {string} - The resolved absolute path to the hooks directory
0 commit comments