There was an error while loading. Please reload this page.
1 parent cbec98b commit c37ca35Copy full SHA for c37ca35
2 files changed
pre-commit.sh
@@ -0,0 +1,16 @@
1
+#!/usr/bin/env bash
2
+# https://stackoverflow.com/questions/26886363/git-how-to-re-stage-the-staged-files-in-a-pre-commit-hook/39521255#39521255
3
+STASH_NAME="pre-commit-$(date +%s)"
4
+git stash save --quiet --keep-index --include-untracked $STASH_NAME
5
+
6
+./tests.sh
7
8
+RESULT=$?
9
+if [ $RESULT -ne 0 ]; then
10
+ git stash save -q "original index"
11
+ git stash apply -q --index stash@{1}
12
+ git stash drop -q; git stash drop -q
13
+fi
14
+[ $RESULT -ne 0 ] && exit 1
15
16
+git add -u
tests.sh
@@ -0,0 +1,6 @@
+cargo fmt --all --check
+cargo test --quiet --locked
+cargo clippy -- --deny warnings
+cargo clippy --tests -- --deny warnings
+find . -name '*.nix' -exec nix fmt {} \+
+nix flake check
0 commit comments