Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): determine correct location of COMMIT_EDITMSG #737

Merged
merged 1 commit into from Aug 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/git/commit.js
@@ -1,4 +1,4 @@
import { spawn } from 'child_process';
import { execSync, spawn } from 'child_process';

import path from 'path';

Expand Down Expand Up @@ -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 {
Expand Down