Skip to content

Commit

Permalink
ci(hooks): add clean step to pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
drewxs committed Mar 21, 2024
1 parent 23f23b1 commit 7eb336d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions hooks/pre-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
echo "Stashing unstaged changes..."
git stash save --keep-index --include-untracked

echo "Cleaning artifacts..."
cargo clean

echo "Formatting code..."
cargo fmt

echo "Checking code..."
if ! cargo check; then
echo "Code check failed with errors. Popping stash..."
git stash pop --quiet
exit 1
echo "Code check failed with errors. Popping stash..."
git stash pop --quiet
exit 1
fi

echo "Code check successful. Popping stash..."
Expand Down

0 comments on commit 7eb336d

Please sign in to comment.