diff --git a/src/git/commit.js b/src/git/commit.js index a193458a..14051b96 100644 --- a/src/git/commit.js +++ b/src/git/commit.js @@ -1,4 +1,4 @@ -import { spawn } from 'child_process'; +import { execSync, spawn } from 'child_process'; import path from 'path'; @@ -50,7 +50,11 @@ function commit (repoPath, message, options, done) { } }); } else { - const commitFilePath = path.join(repoPath, '/.git/COMMIT_EDITMSG'); + const gitDirPath = execSync( + 'git rev-parse --absolute-git-dir', + { cwd: repoPath, encoding: 'utf8' }, + ).trim(); + const commitFilePath = path.join(gitDirPath, 'COMMIT_EDITMSG'); try { const fd = openSync(commitFilePath, 'w'); try {