Carp/scripts/git-hooks/setup.sh
Tim Dévé 1863c82559
chore: Creates pre-commit hook to format Haskell code (#1047)
* chore: moves git hook into own folder

This is is done in preparation of having other git hooks

* chore: Creates script to run formatter

* chore: Checks that ormolu is installed before running it

* chore: Adds pre-commit hook to format Haskell files

* chore: Ensures the ormolu instruction are outputted when running hook

* chore: Prints formatted files on newlines
2020-12-05 14:26:28 +01:00

10 lines
259 B
Bash
Executable File

#!/bin/sh
set -eu
repo_root=$(git rev-parse --show-toplevel)
hooks_folder="$repo_root/.git/hooks"
ln -sf "$repo_root/scripts/git-hooks/commit-msg.sh" "$hooks_folder/commit-msg"
ln -sf "$repo_root/scripts/git-hooks/pre-commit.sh" "$hooks_folder/pre-commit"