diff options
author | Bui Nguyen Quoc Thanh <49302843+thanhbnq@users.noreply.github.com> | 2022-12-14 16:09:23 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-14 10:09:23 +0100 |
commit | 198715eb7d606515c1dd22187080cae483480849 (patch) | |
tree | 8c589931dd773e73c46c7510abf5e4de172b02ee /scripts | |
parent | 4857ffca487d551564dfee41d1ad89f2db9ac1af (diff) | |
download | DLT-daemon-198715eb7d606515c1dd22187080cae483480849.tar.gz |
Updates for Coding Styles (#425)
- Remove uncrustify
- Use clang-format and pre-commit hooks script
- Update README accordingly
Signed-off-by: Bui Nguyen Quoc Thanh <thanh.buinguyenquoc@vn.bosch.com>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/pre-commit.sample | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/scripts/pre-commit.sample b/scripts/pre-commit.sample new file mode 100755 index 0000000..5324c3b --- /dev/null +++ b/scripts/pre-commit.sample @@ -0,0 +1,28 @@ +#!/bin/sh + +gitclangformat=$(which git-clang-format) + +if [ "$gitclangformat" == "" ] +then + gitclangformat=$(find /usr/bin/ -name "git-clang-format*") +fi + +against=`git rev-parse --verify HEAD 2>&1` + +if [ $against == "" ] +then + # Initial commit: diff against an empty tree object + against=5394c6fa5bf40d9bc8619026cbc4c306211a8499 +fi + +$gitclangformat $against -f -q + +if [ $? != 0 ] +then + echo "Format error!" + echo "Use git clang-format" + exit 1 +fi + +# Now update format changes and commit +git add $(git diff --name-only --cached) |