Merge branch 'develop' of github.com:JF002/Pinetime into develop
This commit is contained in:
commit
a25ce5d8fc
|
@ -21,10 +21,6 @@ if (NOT NRF5_SDK_PATH)
|
|||
message(FATAL_ERROR "The path to the NRF52 SDK must be specified on the command line (add -DNRF5_SDK_PATH=<path>")
|
||||
endif ()
|
||||
|
||||
if(NOT USE_JLINK AND NOT USE_GDB_CLIENT AND NOT USE_OPENOCD)
|
||||
set(USE_JLINK true)
|
||||
endif()
|
||||
|
||||
if(USE_JLINK)
|
||||
if (NOT NRFJPROG)
|
||||
message(FATAL_ERROR "the path to the tool nrfjprog must be specified on the command line (add -DNRFJPROG=<path>")
|
||||
|
|
5
hooks/README.md
Normal file
5
hooks/README.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Git hooks
|
||||
|
||||
This directory contains Git hooks that simplify contributing to this repository.
|
||||
|
||||
You can install them by copying the files into `.git/hooks` in the repository folder or by running `git config --local core.hooksPath hooks`
|
25
hooks/pre-commit
Executable file
25
hooks/pre-commit
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
if clang-format --version | grep -q 'version 11\.'; then
|
||||
CLANG_FORMAT_EXECUTABLE="clang-format"
|
||||
else
|
||||
CLANG_FORMAT_EXECUTABLE="clang-format-11"
|
||||
fi
|
||||
|
||||
if ! command -v $CLANG_FORMAT_EXECUTABLE &> /dev/null
|
||||
then
|
||||
echo $CLANG_FORMAT_EXECUTABLE does not exist, make sure to install it
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for FILE in $(git diff --cached --name-only)
|
||||
do
|
||||
if [[ "$FILE" =~ src/[A-Za-z0-9\ \-]+*\.(c|h|cpp|cc)$ ]]; then
|
||||
echo Autoformatting $FILE with $CLANG_FORMAT_EXECUTABLE
|
||||
$CLANG_FORMAT_EXECUTABLE -style=file -i -- $FILE
|
||||
git add -- $FILE
|
||||
elif [[ "$FILE" =~ src/(components|displayapp|drivers|heartratetask|logging|systemtask)/.*\.(c|h|cpp|cc)$ ]]; then
|
||||
echo Autoformatting $FILE with $CLANG_FORMAT_EXECUTABLE
|
||||
$CLANG_FORMAT_EXECUTABLE -style=file -i -- $FILE
|
||||
git add -- $FILE
|
||||
fi
|
||||
done
|
Loading…
Reference in New Issue
Block a user