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 e7abd2c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions xtask/src/pre-commit.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
#!/usr/bin/env bash
set -ex

tf=$(mktemp -t stash.XXX.$$)

cleanup() {
git apply --allow-empty --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
14 changes: 14 additions & 0 deletions xtask/src/pre-push.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
#!/usr/bin/env bash
set -ex

tf=$(mktemp -t stash.XXX.$$)

cleanup() {
git apply --allow-empty --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 e7abd2c

Please sign in to comment.