diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 09:59:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 09:59:37 +0000 |
commit | 76e2632459410dec81337edb6a9fee33c9a660f3 (patch) | |
tree | a73345df208eede4a4daad340515c9328f34625c /git-clang-format.sh | |
parent | Initial commit. (diff) | |
download | apt-76e2632459410dec81337edb6a9fee33c9a660f3.tar.xz apt-76e2632459410dec81337edb6a9fee33c9a660f3.zip |
Adding upstream version 2.7.12.upstream/2.7.12
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'git-clang-format.sh')
-rwxr-xr-x | git-clang-format.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/git-clang-format.sh b/git-clang-format.sh new file mode 100755 index 0000000..da6e6d8 --- /dev/null +++ b/git-clang-format.sh @@ -0,0 +1,12 @@ +#!/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 |