about summary refs log tree commit diff
path: root/src/etc
diff options
context:
space:
mode:
authorCassandra Fridkin <cass@swag.lgbt>2020-10-05 18:57:48 -0400
committerCassandra Fridkin <cass@swag.lgbt>2020-10-05 18:57:48 -0400
commit7de557bf9c550623ce6493b8af940cb9b08c2293 (patch)
tree366367c857bd91f08ceff722953b6770996cc267 /src/etc
parent44af74f6ddf9102b358f271b371697c4b4e6dd2f (diff)
downloadrust-7de557bf9c550623ce6493b8af940cb9b08c2293.tar.gz
rust-7de557bf9c550623ce6493b8af940cb9b08c2293.zip
Move script to src/etc
Diffstat (limited to 'src/etc')
-rwxr-xr-xsrc/etc/pre-commit.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/etc/pre-commit.sh b/src/etc/pre-commit.sh
new file mode 100755
index 00000000000..32af70ec8d4
--- /dev/null
+++ b/src/etc/pre-commit.sh
@@ -0,0 +1,22 @@
+#!/bin/env bash
+#
+# Call `tidy --bless` before each commit
+# Copy this scripts to .git/hooks to activate,
+# and remove it from .git/hooks to deactivate.
+#
+# For help running bash scripts on Windows,
+# see https://stackoverflow.com/a/6413405/6894799
+#
+
+set -Eeuo pipefail
+
+ROOT_DIR="$(git rev-parse --show-toplevel)";
+COMMAND="$ROOT_DIR/x.py test tidy --bless";
+
+if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then
+  COMMAND="python $COMMAND"
+fi
+
+echo "Running pre-commit script $COMMAND";
+
+$COMMAND;