]>
Commit | Line | Data |
---|---|---|
b012e921 | 1 | #!/bin/sh |
a032b68d | 2 | # SPDX-License-Identifier: LGPL-2.1-or-later |
b012e921 | 3 | |
8b3d4ff0 | 4 | set -eu |
b012e921 | 5 | |
8b3d4ff0 MB |
6 | TOP="$(git rev-parse --show-toplevel)" |
7 | ||
8 | case "${1:-}" in | |
f2dec872 | 9 | recdiff) |
8b3d4ff0 | 10 | if [ "${2:-}" = "" ] ; then |
f2dec872 BR |
11 | DIR="$TOP" |
12 | else | |
13 | DIR="$2" | |
14 | fi | |
15 | ||
8b3d4ff0 | 16 | find "$DIR" -type f \( -name '*.[ch]' -o -name '*.xml' \) -exec "$0" diff \{\} \; |
f2dec872 BR |
17 | ;; |
18 | ||
19 | recpatch) | |
8b3d4ff0 | 20 | if [ "${2:-}" = "" ] ; then |
f2dec872 BR |
21 | DIR="$TOP" |
22 | else | |
23 | DIR="$2" | |
24 | fi | |
25 | ||
8b3d4ff0 | 26 | find "$DIR" -type f \( -name '*.[ch]' -o -name '*.xml' \) -exec "$0" patch \{\} \; |
f2dec872 BR |
27 | ;; |
28 | ||
29 | diff) | |
8b3d4ff0 MB |
30 | T="$(mktemp)" |
31 | sed '/^$/N;/^\n$/D' <"${2:?}" >"$T" | |
f2dec872 BR |
32 | diff -u "$2" "$T" |
33 | rm -f "$T" | |
34 | ;; | |
35 | ||
36 | patch) | |
8b3d4ff0 | 37 | sed -i '/^$/N;/^\n$/D' "${2:?}" |
f2dec872 BR |
38 | ;; |
39 | ||
40 | *) | |
41 | echo "Expected recdiff|recpatch|diff|patch as verb." >&2 | |
42 | ;; | |
b012e921 | 43 | esac |