File: git-clang-format.sh

package info (click to toggle)
apt 3.1.5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 22,348 kB
  • sloc: cpp: 69,988; sh: 31,405; xml: 5,547; perl: 217; python: 197; ansic: 189; makefile: 41
file content (12 lines) | stat: -rwxr-xr-x 498 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
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