diff --git a/xtask/src/pre-commit.sh b/xtask/src/pre-commit.sh index 5b974c7ea..e68b9451f 100755 --- a/xtask/src/pre-commit.sh +++ b/xtask/src/pre-commit.sh @@ -1,2 +1,16 @@ #!/usr/bin/env bash -cargo xtask check --verbose +set -ex + +tf=$(mktemp -t stash.XXX.$$) + +cleanup() { + git apply --whitespace=nowarn < "$tf" && git stash drop -q + rm "$tf" +} + +git diff --full-index --binary > "$tf" +git stash -q --keep-index + +trap cleanup EXIT + +cargo xtask check --verbose \ No newline at end of file diff --git a/xtask/src/pre-push.sh b/xtask/src/pre-push.sh index eb2cd59e9..504c6ebb7 100755 --- a/xtask/src/pre-push.sh +++ b/xtask/src/pre-push.sh @@ -1,2 +1,18 @@ #!/usr/bin/env bash +set -ex + +tf=$(mktemp -t stash.XXX.$$) + +cleanup() { + git apply --whitespace=nowarn < "$tf" && git stash drop -q + rm "$tf" +} + +git diff --full-index --binary > "$tf" +git stash -q --keep-index + +trap cleanup EXIT + cargo xtask test --verbose + +