From 4ba98970e0ec9963bbd9004f75e6fcde744e6bdb Mon Sep 17 00:00:00 2001 From: Jeroen de Bruijn Date: Fri, 29 Mar 2019 13:41:02 +0100 Subject: [PATCH 1/3] fix: update commit msg for when using commitAll The commit message now shows that all staged files are committed too. --- lib/lifecycles/commit.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/lifecycles/commit.js b/lib/lifecycles/commit.js index c273949be..dd2d9a6b4 100644 --- a/lib/lifecycles/commit.js +++ b/lib/lifecycles/commit.js @@ -31,6 +31,12 @@ function execCommit (args, newVersion) { toAdd += ' ' + path.relative(process.cwd(), p) } }) + + if (args.commitAll) { + msg += ' and %s' + paths.push('all staged files'); + } + checkpoint(args, msg, paths) return runExec(args, 'git add' + toAdd + ' ' + args.infile) .then(() => { From 25f71fbe33aa5b0f51cf258bf1484198f72ad492 Mon Sep 17 00:00:00 2001 From: Jeroen de Bruijn Date: Fri, 29 Mar 2019 13:51:54 +0100 Subject: [PATCH 2/3] chore: remove trailing semicolon --- lib/lifecycles/commit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lifecycles/commit.js b/lib/lifecycles/commit.js index dd2d9a6b4..f54ddfb63 100644 --- a/lib/lifecycles/commit.js +++ b/lib/lifecycles/commit.js @@ -34,7 +34,7 @@ function execCommit (args, newVersion) { if (args.commitAll) { msg += ' and %s' - paths.push('all staged files'); + paths.push('all staged files') } checkpoint(args, msg, paths) From 9e434cc7dc9d5f4786ebf46f360c78150d08c90e Mon Sep 17 00:00:00 2001 From: Jeroen de Bruijn Date: Tue, 2 Apr 2019 13:49:34 +0200 Subject: [PATCH 3/3] fix: add test for commit msg for when using commitAll --- test.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test.js b/test.js index 88126d430..89b169359 100644 --- a/test.js +++ b/test.js @@ -667,6 +667,18 @@ describe('cli', function () { result.stdout.should.not.match(/npm publish/) }) + it('does not display `all staged files` without the --commit-all flag', function () { + var result = execCli() + result.code.should.equal(0) + result.stdout.should.not.match(/and all staged files/) + }) + + it('does display `all staged files` if the --commit-all flag is passed', function () { + var result = execCli('--commit-all') + result.code.should.equal(0) + result.stdout.should.match(/and all staged files/) + }) + it('includes merge commits', function () { var branchName = 'new-feature' commit('feat: first commit')