mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-14 20:18:39 +00:00
1a56dcd4da
"nm-code-format.sh" is going to change the default behavior from "-n" to "-i", that is, from check-only to reformat. Explicitly pass "-n" where we want it.
22 lines
413 B
Bash
Executable file
22 lines
413 B
Bash
Executable file
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
DISABLED=${NM_HOOK_DISABLED:0}
|
|
|
|
if [ "$DISABLED" == 1 ]; then
|
|
echo "COMMIT HOOK DISABLED"
|
|
exit 0
|
|
fi
|
|
|
|
FORMATTER=contrib/scripts/nm-code-format.sh
|
|
|
|
# Filter only C source files
|
|
CHANGED_FILES=$(git log --pretty='' --name-only -n1 | grep -E '\.c$|\.h$' | tr '\n' ' ')
|
|
|
|
echo $CHANGED_FILES
|
|
|
|
if [ -x "$FORMATTER" ] && [ ! -z "$CHANGED_FILES" ]; then
|
|
"$FORMATTER" -n "${CHANGED_FILES}"
|
|
fi
|