From 8fbf766f85616730173e9d1e85776126732e7b15 Mon Sep 17 00:00:00 2001 From: Akira Date: Thu, 8 Oct 2020 13:30:07 +0900 Subject: [PATCH] add environment variable GIT_DIR git will search `.git` dir on `GIT_DIR` if specified, so I add this to the code. --- src/utils/find-hooks-dir.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/utils/find-hooks-dir.js b/src/utils/find-hooks-dir.js index e1655fd49..c691006ff 100644 --- a/src/utils/find-hooks-dir.js +++ b/src/utils/find-hooks-dir.js @@ -5,6 +5,10 @@ const path = require('path') const findParent = require('./find-parent') function findHooksDir(dir) { + // ENV GIT_DIR expects the location of .git + if (process.env.GIT_DIR) { + return path.resolve(dir, process.env.GIT_DIR) + } if (dir) { let gitDir = path.join(dir, '.git') if (!fs.existsSync(gitDir)) {