@@ -19,15 +19,26 @@ module.exports = function (args, newVersion) {
19
19
20
20
function execCommit ( args , newVersion ) {
21
21
let msg = 'committing %s'
22
- let paths = [ args . infile ]
22
+ let paths = [ ]
23
23
let verify = args . verify === false || args . n ? '--no-verify ' : ''
24
24
let toAdd = ''
25
+
26
+ // only start with a pre-populated paths list when CHANGELOG processing is not skipped
27
+ if ( ! args . skip . changelog ) {
28
+ paths = [ args . infile ]
29
+ toAdd += ' ' + args . infile
30
+ }
31
+
25
32
// commit any of the config files that we've updated
26
33
// the version # for.
27
34
Object . keys ( bump . getUpdatedConfigs ( ) ) . forEach ( function ( p ) {
28
- msg += ' and %s'
29
35
paths . unshift ( p )
30
36
toAdd += ' ' + path . relative ( process . cwd ( ) , p )
37
+
38
+ // account for multiple files in the output message
39
+ if ( paths . length > 1 ) {
40
+ msg += ' and %s'
41
+ }
31
42
} )
32
43
33
44
if ( args . commitAll ) {
@@ -36,8 +47,14 @@ function execCommit (args, newVersion) {
36
47
}
37
48
38
49
checkpoint ( args , msg , paths )
39
- return runExec ( args , 'git add' + toAdd + ' ' + args . infile )
50
+
51
+ // nothing to do, exit without commit anything
52
+ if ( args . skip . changelog && args . skip . bump && toAdd . length === 0 ) {
53
+ return Promise . resolve ( )
54
+ }
55
+
56
+ return runExec ( args , 'git add' + toAdd )
40
57
. then ( ( ) => {
41
- return runExec ( args , 'git commit ' + verify + ( args . sign ? '-S ' : '' ) + ( args . commitAll ? '' : ( args . infile + toAdd ) ) + ' -m "' + formatCommitMessage ( args . message , newVersion ) + '"' )
58
+ return runExec ( args , 'git commit ' + verify + ( args . sign ? '-S ' : '' ) + ( args . commitAll ? '' : ( toAdd ) ) + ' -m "' + formatCommitMessage ( args . message , newVersion ) + '"' )
42
59
} )
43
60
}
0 commit comments