fix: use git commit -F - to preserve newlines in commit messages
commitFileWithBody passed the message through JSON.stringify with git commit -m, which escaped newlines to literal \n characters. Switch to git commit -F - with stdin input to preserve actual newlines.
This commit is contained in:
parent
c6704c3a04
commit
2f1d2c30af
1 changed files with 1 additions and 1 deletions
|
|
@ -18,7 +18,7 @@ export function commitFile(path: string, message: string, cwd = process.cwd()):
|
||||||
export function commitFileWithBody(path: string, header: string, body: string, cwd = process.cwd()): void {
|
export function commitFileWithBody(path: string, header: string, body: string, cwd = process.cwd()): void {
|
||||||
execSync(`git add ${path}`, { cwd })
|
execSync(`git add ${path}`, { cwd })
|
||||||
const msg = `${header}\n\n${body}`
|
const msg = `${header}\n\n${body}`
|
||||||
execSync(`git commit -m ${JSON.stringify(msg)}`, { cwd })
|
execSync(`git commit -F -`, { cwd, input: msg })
|
||||||
}
|
}
|
||||||
|
|
||||||
export function branchExists(branch: string, cwd = process.cwd()): boolean {
|
export function branchExists(branch: string, cwd = process.cwd()): boolean {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue