From e5aa7deae152e24cda8b84c18aefd382bb1d3405 Mon Sep 17 00:00:00 2001 From: Huachao Huang Date: Thu, 14 Oct 2021 12:25:53 -0700 Subject: [PATCH] Fix format script for Ubuntu (#9028) Summary: I get `clang-format-diff` after running `apt install clang-format` on Ubuntu instead of `clang-format-diff.py`. So I think it makes sense to make the format script compatible with this behavior. Pull Request resolved: https://github.com/facebook/rocksdb/pull/9028 Reviewed By: ajkr Differential Revision: D31634041 Pulled By: jay-zhuang fbshipit-source-id: b936de791ddcafa6ff304039ef33936e1e04864d --- build_tools/format-diff.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build_tools/format-diff.sh b/build_tools/format-diff.sh index 80b5d8a4c..c4377a8b8 100755 --- a/build_tools/format-diff.sh +++ b/build_tools/format-diff.sh @@ -38,7 +38,9 @@ if [ "$CLANG_FORMAT_DIFF" ]; then fi else # First try directly executing the possibilities - if clang-format-diff.py --help &> /dev/null < /dev/null; then + if clang-format-diff --help &> /dev/null < /dev/null; then + CLANG_FORMAT_DIFF=clang-format-diff + elif clang-format-diff.py --help &> /dev/null < /dev/null; then CLANG_FORMAT_DIFF=clang-format-diff.py elif $REPO_ROOT/clang-format-diff.py --help &> /dev/null < /dev/null; then CLANG_FORMAT_DIFF=$REPO_ROOT/clang-format-diff.py