Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release.sh: Bail early if there are uncommitted changes #316

Merged
merged 3 commits into from
Jan 4, 2017

Conversation

kegsay
Copy link
Member

@kegsay kegsay commented Jan 4, 2017

This catches both things that are visible on git diff as well as staged (added) files. Cargo-culted from http://stackoverflow.com/questions/2657935/checking-for-a-dirty-index-or-untracked-files-with-git and manually tested both scenarios.

@kegsay kegsay requested a review from richvdh January 4, 2017 11:58
@@ -32,6 +32,19 @@ if [ "$ret" -eq 0 ]; then
exit
fi

ret=0
git diff-index --quiet --cached HEAD || ret=$?
if [ "$ret" -eq 1 ]; then
Copy link
Member

Choose a reason for hiding this comment

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

how about -ne 0 instead here, to catch other errors?

In fact, why not just

if ! git diff-index --quiet --cached HEAD; then
 ...

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@richvdh
Copy link
Member

richvdh commented Jan 4, 2017

lgtm, thanks

@richvdh richvdh merged commit 2a51e7a into develop Jan 4, 2017
@t3chguy t3chguy deleted the kegan/release-script-dies-if-uncommitted-changes branch May 10, 2022 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants