diff --git a/script/setup b/script/setup index 7f3fcdaf2502..19936a1f9126 100755 --- a/script/setup +++ b/script/setup @@ -31,6 +31,16 @@ fi script/bootstrap +# Remove hooks installed by pre-commit before it was replaced by prek, so prek +# doesn't keep them as legacy hooks and run in migration mode +hooks_dir="$(git rev-parse --git-path hooks)" +for hook in "$hooks_dir/pre-commit" "$hooks_dir/pre-commit.legacy"; do + if grep -qs "File generated by pre-commit" "$hook"; then + echo "Removing $hook installed by pre-commit." + rm "$hook" + fi +done + prek install hass --script ensure_config -c config