1
0
Fork 0
apt/git-clang-format.sh
Daniel Baumann 6810ba718b
Adding upstream version 3.0.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-20 21:10:43 +02:00

12 lines
498 B
Bash
Executable file

#!/bin/sh
cd "$(dirname "$0")"
CLANG_FORMAT="$(find $(echo "$PATH" | tr ':' ' ') -name 'git-clang-format-*' | sort | tail -n1 )"
if [ -z "$CLANG_FORMAT" ]; then
echo >&2 'Could not find a clang-format to use. Is the package clang-format installed?'
exit 1
fi
git "$(basename "$CLANG_FORMAT" | cut -d'-' -f 2-)" --diff "$@" | \
sed "s#+/\*\}\}\}\*/#+ /*}}}*/#" | \
grep -v '^clang-format did not modify any files$' | \
grep -v '^no modified files to format$' | \
patch -p1