This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a commit to branch unity-staging
in repository https://gitbox.apache.org/repos/asf/tvm.git

commit 1c469d468fc5f8dccd7c9c4ff9bfb6208cf0e8a6
Author: tqchen <[email protected]>
AuthorDate: Sun May 7 20:50:14 2023 -0400

    [LINT] Fix clang-format script for newest clang-format
---
 tests/lint/git-clang-format.sh | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/tests/lint/git-clang-format.sh b/tests/lint/git-clang-format.sh
index e640e05867..9bb931f47c 100755
--- a/tests/lint/git-clang-format.sh
+++ b/tests/lint/git-clang-format.sh
@@ -51,7 +51,12 @@ done
 
 cleanup()
 {
-  rm -rf /tmp/$$.clang-format.txt
+    if [ -f /tmp/$$.clang-format.txt ]; then
+       echo ""
+       echo "---------clang-format log----------"
+        cat /tmp/$$.clang-format.txt
+    fi
+    rm -rf /tmp/$$.clang-format.txt
 }
 trap cleanup 0
 
@@ -76,6 +81,8 @@ if [[ "$INPLACE_FORMAT" == "true" ]]; then
     exit 0
 fi
 
+touch /tmp/$$.clang-format.txt
+
 if [[ "$LINT_ALL_FILES" == "true" ]]; then
     echo "Running git-clang-format against all C++ files"
     git-${CLANG_FORMAT} --diff --extensions h,mm,c,cc --binary=${CLANG_FORMAT} 
"$REVISION" 1> /tmp/$$.clang-format.txt
@@ -84,9 +91,6 @@ else
     git-${CLANG_FORMAT} --diff --extensions h,mm,c,cc --binary=${CLANG_FORMAT} 
"$REVISION" 1> /tmp/$$.clang-format.txt
 fi
 
-echo "---------clang-format log----------"
-cat /tmp/$$.clang-format.txt
-echo ""
 if grep --quiet -E "diff" < /tmp/$$.clang-format.txt; then
     echo "clang-format lint error found. Consider running clang-format-15 on 
these files to fix them."
     exit 1

Reply via email to