summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-10-14 15:23:48 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-10-14 13:56:23 +0000
commit1bb9f06b5dbec1c01ef9d4c8693dce56e93f70e6 (patch)
treed2ffc48007890014b83a2d87eb8ff8db7541683d
parent1b2c1b6c5d040d76baada70feff82986e3811f48 (diff)
clang-format-pre-commit: Find git-clang-format pointed to by LLVM_INSTALL_DIR
In a Qt setup, LLVM is pointed to by the variable but not in the path as not to auto-detect the Clang mkspec. Change-Id: If3dbaa158b7e9eb7e84745cf51afe0ea6e51aa1c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rwxr-xr-xgit-hooks/clang-format-pre-commit7
1 files changed, 6 insertions, 1 deletions
diff --git a/git-hooks/clang-format-pre-commit b/git-hooks/clang-format-pre-commit
index 8b18541..9689d74 100755
--- a/git-hooks/clang-format-pre-commit
+++ b/git-hooks/clang-format-pre-commit
@@ -12,7 +12,12 @@
# mklink pre-commit ..\..\..\qtrepotools\git-hooks\clang-format-pre-commit
#
-CLANG_FORMAT=`which git-clang-format`
+CLANG_FORMAT=$(which git-clang-format)
+if [ -z "$CLANG_FORMAT" -a -d "$LLVM_INSTALL_DIR" ]; then
+ export PATH=$PATH:$LLVM_INSTALL_DIR/bin
+ CLANG_FORMAT=$(which git-clang-format)
+fi
+
if test -z "$CLANG_FORMAT"; then
echo "Please install clang-format and make sure git-clang-format is in the path."
exit 0