Skip to content

Commit

Permalink
fix(i18n/update-source): handle single quotes in commit messages (#23758
Browse files Browse the repository at this point in the history
)
  • Loading branch information
pieh committed May 5, 2020
1 parent 18b1628 commit 8a82187
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion scripts/i18n/update-source.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,13 @@ async function updateSourceRepo() {
logger.info(`Committing changes`)
shell.exec(`git add .`)

if (shell.exec(`git commit -m '${commitMessage}' > /dev/null`).code !== 0) {
// need to "escape" single quotes in commit message
// http://blog.stvjam.es/2016/11/using-quotes-in-git-command-line-commit-messages/#Using-Single-Quotes
if (
shell.exec(
`git commit -m '${commitMessage.replace(/'/g, `'\\''`)}' > /dev/null`
).code !== 0
) {
logger.error(`Failed to commit to ${sourceRepo}`)
process.exit(1)
}
Expand Down

0 comments on commit 8a82187

Please sign in to comment.