diff options
| author | Caian Benedicto <caianbene@gmail.com> | 2024-12-13 18:29:28 -0300 |
|---|---|---|
| committer | Caian Benedicto <caianbene@gmail.com> | 2024-12-13 20:26:52 -0300 |
| commit | d7f5cdc2f971af524c496aaeb25226eb9f8236df (patch) | |
| tree | 1e69d1088ee67407b1058f490cc188cd1dd4e287 /scripts/git | |
| parent | 78773d732672d8985795fb040a39dd7e946c7b7c (diff) | |
| parent | 98926047586154269bb269d01e3e52e60e044035 (diff) | |
| download | invidious-d7f5cdc2f971af524c496aaeb25226eb9f8236df.tar.gz invidious-d7f5cdc2f971af524c496aaeb25226eb9f8236df.tar.bz2 invidious-d7f5cdc2f971af524c496aaeb25226eb9f8236df.zip | |
Merge branch 'master' into unix-sockets
Diffstat (limited to 'scripts/git')
| -rw-r--r-- | scripts/git/pre-commit | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/git/pre-commit b/scripts/git/pre-commit new file mode 100644 index 00000000..4460b670 --- /dev/null +++ b/scripts/git/pre-commit @@ -0,0 +1,17 @@ +# Useful precomit hooks +# Please see https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks for instructions on installation. + +# Crystal linter +# This is a modified version of the pre-commit hook from the crystal repo. https://github.com/crystal-lang/crystal/blob/master/scripts/git/pre-commit +# Please refer to that if you'd like an version that doesn't automatically format staged files. +changed_cr_files=$(git diff --cached --name-only --diff-filter=ACM | grep '\.cr$') +if [ ! -z "$changed_cr_files" ]; then + if [ -x bin/crystal ]; then + # use bin/crystal wrapper when available to run local compiler build + bin/crystal tool format $changed_cr_files >&2 + else + crystal tool format $changed_cr_files >&2 + fi + + git add $changed_cr_files +fi |
