From ad88cbb8a359bf093c9e32b5e4ab1b353dfd7ae2 Mon Sep 17 00:00:00 2001 From: Sing_chan <51314274+betterpig@users.noreply.github.com> Date: Wed, 22 Jun 2022 11:39:20 +0800 Subject: [PATCH] test=document_fix;pre install clang-format to avoid repeat installation due to pre-commit multi-thread running (#43734) --- tools/codestyle/pre_commit.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/codestyle/pre_commit.sh b/tools/codestyle/pre_commit.sh index 7ea8a1658d..9eedddf658 100755 --- a/tools/codestyle/pre_commit.sh +++ b/tools/codestyle/pre_commit.sh @@ -19,6 +19,16 @@ if ! [[ $(pre-commit --version) == *"2.17.0"* ]]; then pip install pre-commit==2.17.0 1>nul fi +# Install clang-format before git commit to avoid repeat installation due to +# pre-commit multi-thread running. +readonly VERSION="13.0.0" +version=$(clang-format -version) +if ! [[ $(python -V 2>&1 | awk '{print $2}' | awk -F '.' '{print $1$2}') -ge 36 ]]; then + echo "clang-format installation by pip need python version great equal 3.6, + please change the default python to higher version." + exit 1 +fi + diff_files=$(git diff --numstat ${BRANCH} | awk '{print $NF}') echo -e "diff files between pr and ${BRANCH}:\n${diff_files}" -- GitLab