Re: [PATCH 3/3] hook-list.h: add a generated list of hooks, like config-list.h
From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2021-06-20 13:59:07
On Fri, Jun 18 2021, Eric Sunshine wrote:
On Fri, Jun 18, 2021 at 1:06 PM SZEDER Gábor [off-list ref] wrote:quoted
On Thu, Jun 17, 2021 at 12:09:36PM +0200, Ævar Arnfjörð Bjarmason wrote:quoted
diff --git a/generate-hooklist.sh b/generate-hooklist.sh@@ -0,0 +1,24 @@ +#!/bin/sh + +echo "/* Automatically generated by generate-hooklist.sh */" + +print_hook_list () { + cat <<EOF +static const char *hook_name_list[] = { +EOF + perl -ne 'Why Perl? At the moment I can run 'make' and get a functioning git even when Perl is not installed. With this patch that wouldn't work anymore. Both 'generate-cmdlist.sh' and 'generate-configlist.sh' can process the documentation into a header file with a long list in it without resorting to Perl; I'm sure that hooks could be processed without Perl as well.That's a good point and not an idle question. It wasn't all that long ago that I rewrote `generate-cmdlist` in Perl and got a complaint that the Git project was no longer buildable on FreeBSD[1], with the result that I ended up re-implementing it (again) in shell[2]. [1]: https://lore.kernel.org/git/loom.20150814T171757-901@post.gmane.org/ (local) [2]: https://lore.kernel.org/git/1440365469-9928-1-git-send-email-sunshine@sunshineco.com/ (local)
I'm sympathetic to changing this from Perl, as can be seen from the "v1" (as part of another series) I intially used an unportable grep flag for it. I'll test and probably convert it to René's few-liner. The [1] link is not it not being buildable on FreeBSD though, it's someone understandably not understanding what NO_PERL=Y means, because we really should call it PERL_ONLY_FOR_BUILDING_AND_TESTING or something. Aside from this series it would be useful to clarify that point, what do we really think it means? I was under the impression that it meant that, and I really shouldn't be giving it a second thought if we introduced a perl dependency during the build or testing.