aboutsummaryrefslogtreecommitdiff
path: root/tools/generate-hooklist.sh
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2026-03-19 06:33:24 +0100
committerJunio C Hamano <gitster@pobox.com>2026-03-19 06:40:09 -0700
commita767f2fd6c5a6104ff32a35a27f0c15aec546957 (patch)
treed558fdbd55b625018b35d7e83ac3c1d4217ef318 /tools/generate-hooklist.sh
parent405c98a6a0e017f41f5de9c649a8f6f1b3fc4314 (diff)
downloadgit-a767f2fd6c5a6104ff32a35a27f0c15aec546957.tar.xz
builds: move build scripts into "tools/"
We have a bunch of scripts used by our different build systems that are all located in the top-level directory. Now that we have introduced the new "tools/" directory though we have a better home for them. Move the scripts into the "tools/" directory. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'tools/generate-hooklist.sh')
-rwxr-xr-xtools/generate-hooklist.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/tools/generate-hooklist.sh b/tools/generate-hooklist.sh
new file mode 100755
index 0000000000..e0cdf26944
--- /dev/null
+++ b/tools/generate-hooklist.sh
@@ -0,0 +1,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.adoc |
+ LC_ALL=C sort
+
+cat <<EOF
+ NULL,
+};
+EOF
+
+} >"$OUTPUT"