From 74a040a517e489111709c5acd7826543ad814af0 Mon Sep 17 00:00:00 2001 From: Jeroen de Bruijn Date: Mon, 8 Apr 2019 17:58:57 +0200 Subject: [PATCH] feat: update commit msg for when using commitAll (#320) we now indicate that staged files have been included in release in output. --- lib/lifecycles/commit.js | 6 ++++++ test.js | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/lib/lifecycles/commit.js b/lib/lifecycles/commit.js index c273949be..f54ddfb63 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(() => { 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')