Skip to content

Commit

Permalink
only check staged content
Browse files Browse the repository at this point in the history
  • Loading branch information
Emilgardis committed Jul 6, 2022
1 parent 65add5b commit 1ded0d8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
16 changes: 15 additions & 1 deletion xtask/src/pre-commit.sh
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions xtask/src/pre-push.sh
Original file line number Diff line number Diff line change
@@ -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


0 comments on commit 1ded0d8

Please sign in to comment.