Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre push hook #1786

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions tools/hooks/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/sh

# To use this pre-push git hook please move this file to: quiche/.git/hooks/pre-push to automatically activate it.

# A hook script to verify what is about to be pushed. Called by "git
# push" after it has checked the remote status, but before anything has been
# pushed. If this script exits with a non-zero status nothing will be pushed.
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
#
# If pushing without using a named remote those arguments will be equal.

remote="$1"
#url="$2" # unused argument to pre-push hook script

if [ $remote = "origin" ]
then
echo "----------------------------"
echo "Running pre-push git hook..."
if cargo +nightly fmt -- --check ; then
if cargo clippy --features=ffi,qlog,boringssl-boring-crate -- -D warnings; then
echo "PASSED"
echo "----------------------------"
else
echo "FAILED: cargo clippy failed. Try: cargo clippy --fix --features=ffi,qlog,boringssl-boring-crate -- -D warnings"
echo "If you would like to disable this check: git push --no-verify <remote>"
echo "----------------------------"
exit 1 # Failed
fi
else
echo "FAILED: cargo fmt failed. Try: cargo +nightly fmt"
echo "If you would like to disable this check: git push --no-verify <remote>"
echo "----------------------------"
exit 1 # Failed
fi
fi

exit 0 # Passed