summaryrefslogtreecommitdiffstats
path: root/.githooks/pre-push
blob: 1445afe143eb93a30f20676ebcd811735fc69978 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh

STASH_NAME="pre-push-$(date +%s)"
git stash save -q --keep-index "$STASH_NAME"

# Format Check
if ! cargo fmt; then
    echo "Error: Code formatting violations detected. Run 'cargo fmt'." >&2
    git stash pop -q
    exit 1
fi

# Test Suite
# if ! cargo test; then
#     echo "Error: Test suite failed." >&2
#     git stash pop -q
#     exit 1
# fi

git stash pop -q
exit 0