diff --git a/lib/cli.js b/lib/cli.js index 9429a179..15e91372 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -1,4 +1,4 @@ -const {spawn, execSync} = require('child_process'); +const {spawn} = require('child_process'); const fs = require('fs'); const {join} = require('path'); const shellescape = require('any-shell-escape'); @@ -32,20 +32,6 @@ const main = async () => { if (cliOptions.dryRun) { // eslint-disable-next-line no-console console.log('Running in dry mode.'); - } else { - try { - /** - * @author https://github.com/rodrigograca31 - * @see https://github.com/streamich/git-cz/issues/177 - * - * It exits with 1 if there were differences and 0 means no differences. - * Because of that we negate it to only throw an error if there's no files staged - * https://stackoverflow.com/questions/367069/how-can-i-negate-the-return-value-of-a-process - */ - execSync('! git diff HEAD --staged --quiet --exit-code'); - } catch (error) { - throw new Error('No files staged.'); - } } const state = createState({disableEmoji: cliOptions.disableEmoji});