diff --git a/src/etc/pre-push.sh b/src/etc/pre-push.sh index 33ed2f0e406b1..210edbf0cda66 100755 --- a/src/etc/pre-push.sh +++ b/src/etc/pre-push.sh @@ -21,6 +21,13 @@ if $SKIP; then exit 0 fi +if [ -n "$(git status --porcelain --untracked-files=no)" ]; then + echo "error: working tree is dirty, refusing to push" + echo " commit, stash, or discard changes first." + echo "You may use \`git push --no-verify\` to skip this check." + exit 1 +fi + ROOT_DIR="$(git rev-parse --show-toplevel)" echo "Running pre-push script $ROOT_DIR/x test tidy"