Browse Source

use the newest available git-clang-format in PATH

Hardcoding a specific version is sad as default versions change over
time, so instead of tying us to a specific clang version we let the
script figure out a good version by looking at what is available in
PATH.

Gbp-Dch: Ignore
tags/devuan/2.0.1+devuan1
David Kalnischkies 2 years ago
parent
commit
fd9f75b316
1 changed files with 8 additions and 1 deletions
  1. +8
    -1
      git-clang-format.sh

+ 8
- 1
git-clang-format.sh View File

@@ -1,3 +1,10 @@
#!/bin/sh
cd "$(dirname "$0")"
git clang-format-3.8 --diff "$@" | sed "s#+/\*\}\}\}\*/#+ /*}}}*/#" | patch -p1
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

Loading…
Cancel
Save