Skip to content

Commit 1d1bc88

Browse files
committed
Add posibility to install git-hooks globally
1 parent 8fb8c19 commit 1d1bc88

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

lib/git-hooks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ function spawnHook(hookName, args) {
197197
* @returns {String|undefined}
198198
*/
199199
function getClosestGitPath(currentPath) {
200-
currentPath = currentPath || __dirname;
200+
currentPath = currentPath || process.cwd();
201201

202202
var dirnamePath = path.join(currentPath, '.git');
203203

lib/hook-template.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,8 @@ try {
1616
});
1717
} catch (e) {
1818
console.error('[GIT-HOOKS ERROR] ' + e.message);
19+
20+
if (e.code === 'MODULE_NOT_FOUND') {
21+
console.error('[GIT-HOOKS ERROR] Please reinstall git-hooks to fix this error');
22+
}
1923
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "git-hooks",
33
"description": "A tool to manage project Git hooks",
44
"author": "Alexander Tarmolov <tarmolov@gmail.com>",
5-
"version": "1.0.2",
5+
"version": "1.1.0",
66
"repository": "https://github.com/tarmolov/git-hooks-js",
77
"contributors": [
88
"Alexander Tarmolov <tarmolov@gmail.com> (http://tarmolov.ru/)",

0 commit comments

Comments
 (0)