summaryrefslogtreecommitdiffstats
path: root/git-clang-format.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 06:14:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 06:14:41 +0000
commit549a391d6438e828001eeeaf235b080c054a7bf3 (patch)
tree1bb6b1ea5987fa167a1d13abe82209cc882dd94b /git-clang-format.sh
parentInitial commit. (diff)
downloadapt-549a391d6438e828001eeeaf235b080c054a7bf3.tar.xz
apt-549a391d6438e828001eeeaf235b080c054a7bf3.zip
Adding upstream version 2.2.4.upstream/2.2.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'git-clang-format.sh')
-rwxr-xr-xgit-clang-format.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/git-clang-format.sh b/git-clang-format.sh
new file mode 100755
index 0000000..6348652
--- /dev/null
+++ b/git-clang-format.sh
@@ -0,0 +1,10 @@
+#!/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#+/\*\}\}\}\*/#+ /*}}}*/#" | \
+ patch -p1