Skip to content

Commit

Permalink
Merge pull request #180 from streamich/revert-178-staged-files-check
Browse files Browse the repository at this point in the history
Revert "feat: 🎸 check for staged files"
  • Loading branch information
streamich committed May 26, 2020
2 parents a71932a + 8ebebd1 commit 7de648a
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions lib/cli.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down Expand Up @@ -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});
Expand Down

1 comment on commit 7de648a

@streamich
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build version: 4.5.0-master.823 🤞 master on Travis 🎉

Please sign in to comment.