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 e1c2ed4863aec1e5cc3974b05eed0282d88f6027
Author: tqchen <[email protected]>
AuthorDate: Sun May 7 20:50:14 2023 -0400

    [LINT] Fix clang-format script for newest clang-format
    
    In the new clang-format, git-clang-format will exit 1 when there
    is diff, this PR ensures that the diff shows up in console.
---
 tests/lint/git-clang-format.sh | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tests/lint/git-clang-format.sh b/tests/lint/git-clang-format.sh
index e640e05867..22e5833775 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
 
@@ -84,9 +89,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