Fixed hooks
This commit is contained in:
parent
a897d4c4af
commit
b013964615
1 changed files with 11 additions and 3 deletions
|
@ -1,4 +1,12 @@
|
||||||
git_dir=$(git rev-parse --git-dir)
|
#!/bin/sh
|
||||||
project_dir=$(dirname $git_dir)
|
# adapted from https://prettier.io/docs/en/precommit.html#option-5-shell-script
|
||||||
|
FILES=$(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g' | grep '.dart$')
|
||||||
|
[ -z "$FILES" ] && exit 0
|
||||||
|
|
||||||
dart format $project_dir
|
# Format all selected files
|
||||||
|
echo "$FILES" | xargs dart format
|
||||||
|
|
||||||
|
# Add back the formatted files to staging
|
||||||
|
echo "$FILES" | xargs git add
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
Loading…
Reference in a new issue