mirror of
https://github.com/misadeks/tetra-bluestation.git
synced 2026-09-02 00:59:01 +00:00
21 lines
491 B
Bash
Executable File
21 lines
491 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# This script installs the pre-commit hook, that checks whether staged files
|
|
# are formatted according to rustfmt.toml
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
|
|
|
|
ROOT="$(git -C "$SCRIPT_DIR" rev-parse --show-toplevel 2>/dev/null)" || {
|
|
echo "install.sh: not inside a git repository" >&2
|
|
exit 1
|
|
}
|
|
|
|
SRC="$SCRIPT_DIR/pre-commit"
|
|
DST="$ROOT/.git/hooks/pre-commit"
|
|
|
|
cp -f "$SRC" "$DST"
|
|
chmod +x "$DST"
|
|
|
|
echo "Installed: $DST" |