Am 29.06.21 um 02:32 schrieb Junio C Hamano: > Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes: > >> On Sun, 20 Jun 2021, René Scharfe wrote: >> >>> How about something like this? >>> >>> sed -n '/^~~~~*$/ {x; p;}; x' Documentation/githooks.txt | >>> sort | >>> sed 's/^.*$/ "&",/' >>> >>> sed is already used by generate-configlist.sh. >> >> I do like me a good sed script. >> >> Thanks, >> Dscho > > Yup. > > This is buried below the 27-patch series, so the whole thing cannot > advance until this gets sorted out. If it helps: You can add the patch below as number 28 or squash it in. --- >8 --- Subject: [PATCH] generate-hooklist.sh: use sed instead of Perl Allow hooklist.h to be built without Perl by finding, sorting and formatting hook names using two short sed(1) scripts and sort(1). Signed-off-by: René Scharfe <l.s.r@xxxxxx> --- generate-hooklist.sh | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/generate-hooklist.sh b/generate-hooklist.sh index 5a3f7f849c..6f3de0a2ec 100755 --- a/generate-hooklist.sh +++ b/generate-hooklist.sh @@ -6,14 +6,9 @@ print_hook_list () { cat <<EOF static const char *hook_name_list[] = { EOF - perl -ne ' - chomp; - @l[$.] = $_; - push @h => $l[$. - 1] if /^~~~+$/s; - END { - print qq[\t"$_",\n] for sort @h; - } - ' <Documentation/githooks.txt + sed -n '/^~~~~*$/ {x; p;}; x' Documentation/githooks.txt | + sort | + sed 's/^.*$/ "&",/' cat <<EOF NULL, }; -- 2.32.0