diff --git a/.changeset/dirty-actors-retire.md b/.changeset/dirty-actors-retire.md new file mode 100644 index 0000000..7253d9a --- /dev/null +++ b/.changeset/dirty-actors-retire.md @@ -0,0 +1,7 @@ +--- +"@naverpay/commit-helper": patch +--- + +[commithelper] fix: git worktree 환경에서 COMMIT_EDITMSG 절대 경로 처리 + +PR: [[commithelper] fix: git worktree 환경에서 COMMIT_EDITMSG 절대 경로 처리](https://github.com/NaverPayDev/cli/pull/74) diff --git a/packages/commit-helper/bin/cli.ts b/packages/commit-helper/bin/cli.ts index 96ccc85..9d3916e 100644 --- a/packages/commit-helper/bin/cli.ts +++ b/packages/commit-helper/bin/cli.ts @@ -1,6 +1,6 @@ import {exec} from 'child_process' import fs from 'fs/promises' -import {join} from 'path' +import {isAbsolute, join} from 'path' import process from 'process' import {cosmiconfigSync} from 'cosmiconfig' @@ -182,7 +182,7 @@ export async function run() { } const commitMessagePath = cli.input[0] - const commitFilePath = join(process.cwd(), commitMessagePath) + const commitFilePath = isAbsolute(commitMessagePath) ? commitMessagePath : join(process.cwd(), commitMessagePath) const commitMessage = await fs.readFile(commitFilePath, 'utf8') if (!commitMessage) {