diff --git a/lib/cli.js b/lib/cli.js index 9429a179..06193bef 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -38,13 +38,14 @@ const main = async () => { * @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 + * Exits with 1 if there are differences and 0 if no differences. */ - execSync('! git diff HEAD --staged --quiet --exit-code'); + execSync('git diff HEAD --staged --quiet --exit-code'); + + // Executes the following line only if the one above didn't crash (exit code: 0) + signale.warn('No files staged!'); } catch (error) { - throw new Error('No files staged.'); + // eslint-disable no-empty } }