From 7de557bf9c550623ce6493b8af940cb9b08c2293 Mon Sep 17 00:00:00 2001 From: Cassandra Fridkin Date: Mon, 5 Oct 2020 18:57:48 -0400 Subject: [PATCH] Move script to src/etc --- .../install-git-hook/src => etc}/pre-commit.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) rename src/{tools/install-git-hook/src => etc}/pre-commit.sh (50%) diff --git a/src/tools/install-git-hook/src/pre-commit.sh b/src/etc/pre-commit.sh similarity index 50% rename from src/tools/install-git-hook/src/pre-commit.sh rename to src/etc/pre-commit.sh index f47ca3e039ac..32af70ec8d40 100755 --- a/src/tools/install-git-hook/src/pre-commit.sh +++ b/src/etc/pre-commit.sh @@ -1,12 +1,16 @@ -#!/bin/sh +#!/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. # -# To enable this hook, run `./x.py run install-git-hook`. -# To disable it, run `./x.py run install-git-hook --remove` +# For help running bash scripts on Windows, +# see https://stackoverflow.com/a/6413405/6894799 +# + set -Eeuo pipefail -ROOT_DIR=$(git rev-parse --show-toplevel); +ROOT_DIR="$(git rev-parse --show-toplevel)"; COMMAND="$ROOT_DIR/x.py test tidy --bless"; if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then