Skip to content

Commit

Permalink
move install_hooks.sh to scripts/
Browse files Browse the repository at this point in the history
  • Loading branch information
ma2bd committed Apr 30, 2023
1 parent 67e86a1 commit b273189
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions install_hooks.sh → scripts/install_hooks.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
ROOT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd )

if cat <<EOF > $SCRIPT_DIR/.git/hooks/pre-push
if cat <<EOF > $ROOT_DIR/.git/hooks/pre-push
#!/bin/sh
#
# This pre-push hook runs a cargo-clippy and cargo +nightly fmt before pushing code to remote.
Expand All @@ -15,7 +15,7 @@ cargo +nightly fmt -- --check --config unstable_features=true --config imports_g
cargo +nightly udeps --all-targets || { echo "Error: dependency check failed - aborting push." ; exit 1 ; }
EOF
then
chmod +x $SCRIPT_DIR/.git/hooks/pre-push
chmod +x $ROOT_DIR/.git/hooks/pre-push
else
echo "Failed to write pre-push hook"
exit 1
Expand Down

0 comments on commit b273189

Please sign in to comment.