@@ -2,7 +2,7 @@ const bump = require('../lifecycles/bump')
22const checkpoint = require ( '../checkpoint' )
33const formatCommitMessage = require ( '../format-commit-message' )
44const path = require ( 'path' )
5- const runExec = require ( '../run-exec ' )
5+ const runExecFile = require ( '../run-execFile ' )
66const runLifecycleScript = require ( '../run-lifecycle-script' )
77
88module . exports = function ( args , newVersion ) {
@@ -20,20 +20,21 @@ module.exports = function (args, newVersion) {
2020function execCommit ( args , newVersion ) {
2121 let msg = 'committing %s'
2222 let paths = [ ]
23- const verify = args . verify === false || args . n ? '--no-verify ' : ''
24- let toAdd = ''
23+ const verify = args . verify === false || args . n ? [ '--no-verify' ] : [ ]
24+ const sign = args . sign ? [ '-S' ] : [ ]
25+ const toAdd = [ ]
2526
2627 // only start with a pre-populated paths list when CHANGELOG processing is not skipped
2728 if ( ! args . skip . changelog ) {
2829 paths = [ args . infile ]
29- toAdd += ' ' + args . infile
30+ toAdd . push ( args . infile )
3031 }
3132
3233 // commit any of the config files that we've updated
3334 // the version # for.
3435 Object . keys ( bump . getUpdatedConfigs ( ) ) . forEach ( function ( p ) {
3536 paths . unshift ( p )
36- toAdd += ' ' + path . relative ( process . cwd ( ) , p )
37+ toAdd . push ( path . relative ( process . cwd ( ) , p ) )
3738
3839 // account for multiple files in the output message
3940 if ( paths . length > 1 ) {
@@ -53,8 +54,22 @@ function execCommit (args, newVersion) {
5354 return Promise . resolve ( )
5455 }
5556
56- return runExec ( args , 'git add' + toAdd )
57+ return runExecFile ( args , 'git' , [ ' add'] . concat ( toAdd ) )
5758 . then ( ( ) => {
58- return runExec ( args , 'git commit ' + verify + ( args . sign ? '-S ' : '' ) + ( args . commitAll ? '' : ( toAdd ) ) + ' -m "' + formatCommitMessage ( args . releaseCommitMessageFormat , newVersion ) + '"' )
59+ return runExecFile (
60+ args ,
61+ 'git' ,
62+ [
63+ 'commit'
64+ ] . concat (
65+ verify ,
66+ sign ,
67+ args . commitAll ? [ ] : toAdd ,
68+ [
69+ '-m' ,
70+ `"${ formatCommitMessage ( args . releaseCommitMessageFormat , newVersion ) } "`
71+ ]
72+ )
73+ )
5974 } )
6075}
0 commit comments