@@ -2,7 +2,7 @@ const bump = require('../lifecycles/bump')
2
2
const checkpoint = require ( '../checkpoint' )
3
3
const formatCommitMessage = require ( '../format-commit-message' )
4
4
const path = require ( 'path' )
5
- const runExec = require ( '../run-exec ' )
5
+ const runExecFile = require ( '../run-execFile ' )
6
6
const runLifecycleScript = require ( '../run-lifecycle-script' )
7
7
8
8
module . exports = function ( args , newVersion ) {
@@ -20,20 +20,21 @@ module.exports = function (args, newVersion) {
20
20
function execCommit ( args , newVersion ) {
21
21
let msg = 'committing %s'
22
22
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 = [ ]
25
26
26
27
// only start with a pre-populated paths list when CHANGELOG processing is not skipped
27
28
if ( ! args . skip . changelog ) {
28
29
paths = [ args . infile ]
29
- toAdd += ' ' + args . infile
30
+ toAdd . push ( args . infile )
30
31
}
31
32
32
33
// commit any of the config files that we've updated
33
34
// the version # for.
34
35
Object . keys ( bump . getUpdatedConfigs ( ) ) . forEach ( function ( p ) {
35
36
paths . unshift ( p )
36
- toAdd += ' ' + path . relative ( process . cwd ( ) , p )
37
+ toAdd . push ( path . relative ( process . cwd ( ) , p ) )
37
38
38
39
// account for multiple files in the output message
39
40
if ( paths . length > 1 ) {
@@ -53,8 +54,22 @@ function execCommit (args, newVersion) {
53
54
return Promise . resolve ( )
54
55
}
55
56
56
- return runExec ( args , 'git add' + toAdd )
57
+ return runExecFile ( args , 'git' , [ ' add'] . concat ( toAdd ) )
57
58
. 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
+ )
59
74
} )
60
75
}
0 commit comments