diff options
author | Jacob Schatz <jschatz1@gmail.com> | 2017-12-20 12:09:22 -0500 |
---|---|---|
committer | Jacob Schatz <jschatz1@gmail.com> | 2017-12-20 12:09:22 -0500 |
commit | 1d7875386059cb880e8ea8766359e87c42ff8ec6 (patch) | |
tree | cd89a26c65a0811373e34483ff87aa0c8234eb17 /scripts | |
parent | f5290c9738bbca7b130ddc86c0cdcc3f35e34c3a (diff) | |
download | gitlab-ce-1d7875386059cb880e8ea8766359e87c42ff8ec6.tar.gz |
Initial install
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/pre-commit | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/pre-commit b/scripts/pre-commit new file mode 100644 index 00000000000..e3ff5927922 --- /dev/null +++ b/scripts/pre-commit @@ -0,0 +1,11 @@ +#!/bin/sh +jsfiles=$(git diff --cached --name-only --diff-filter=ACM "*.js" "*.jsx" | tr '\n' ' ') +[ -z "$jsfiles" ] && exit 0 + +# Prettify all staged .js files +echo "$jsfiles" | xargs ./node_modules/.bin/prettier --write + +# Add back the modified/prettified files to staging +echo "$jsfiles" | xargs git add + +exit 0
\ No newline at end of file |