format-code.sh: Allow some flexibility when formatting
clang-format doesn't allow us to differentiate between C and C++ styles,
they are both lumped under the 'Language: Cpp' directive.
This doesn't work when you have different styles for each language, for
example in the phosphor-mboxd repository (C in kernel style, C++ in
OpenBMC style, due to history).
phosphor-mboxd ships its own format-code.sh script which deals with its
specific requirements, so lets execute that.
Change-Id: I2bb4a5ffd940dcaac95481c2baf23823dba005ee
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/scripts/format-code.sh b/scripts/format-code.sh
index 0cd6a71..bc42c07 100755
--- a/scripts/format-code.sh
+++ b/scripts/format-code.sh
@@ -27,3 +27,10 @@
xargs -0 "clang-format-5.0" -i
git --no-pager diff --exit-code
fi
+
+# Sometimes your situation is terrible enough that you need the flexibility.
+# For example, phosphor-mboxd.
+if [ -f "format-code.sh" ]; then
+ ./format-code.sh
+ git --no-pager diff --exit-code
+fi