blob: e22068c2fa4139983d685fd3bcd78e3e2a52beb0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#!/bin/sh
#
# Usage: ./generate-hooklist.sh >hook-list.h
SOURCE_DIR="$1"
OUTPUT="$2"
if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
then
echo >&2 "USAGE: $0 <SOURCE_DIR> <OUTPUT>"
exit 1
fi
{
cat <<EOF
/* Automatically generated by generate-hooklist.sh */
static const char *hook_name_list[] = {
EOF
sed -n \
-e '/^~~~~*$/ {x; s/^.*$/ "&",/; p;}' \
-e 'x' \
<"$SOURCE_DIR"/Documentation/githooks.txt |
LC_ALL=C sort
cat <<EOF
NULL,
};
EOF
} >"$OUTPUT"
|