From: "René Scharfe" <l.s.r@web.de>
To: Junio C Hamano <gitster@pobox.com>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: "SZEDER Gábor" <szeder.dev@gmail.com>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
git@vger.kernel.org, "Emily Shaffer" <emilyshaffer@google.com>,
"Jeff Hostetler" <jeffhost@microsoft.com>,
"Felipe Contreras" <felipe.contreras@gmail.com>
Subject: Re: [PATCH 3/3] hook-list.h: add a generated list of hooks, like config-list.h
Date: Tue, 29 Jun 2021 19:53:55 +0200 [thread overview]
Message-ID: <20b1bfb6-8881-2a21-1753-0e2e508a7861@web.de> (raw)
In-Reply-To: <xmqqv95x4ijd.fsf@gitster.g>
Am 29.06.21 um 02:32 schrieb Junio C Hamano:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> 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@web.de>
---
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
next prev parent reply other threads:[~2021-06-29 17:54 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-17 10:09 [PATCH 0/3] Add a generated list of hooks in hook-list.h Ævar Arnfjörð Bjarmason
2021-06-17 10:09 ` [PATCH 1/3] hook.[ch]: move find_hook() to this new library Ævar Arnfjörð Bjarmason
2021-06-17 10:09 ` [PATCH 2/3] hook.c: add a hook_exists() wrapper and use it in bugreport.c Ævar Arnfjörð Bjarmason
2021-06-17 10:09 ` [PATCH 3/3] hook-list.h: add a generated list of hooks, like config-list.h Ævar Arnfjörð Bjarmason
2021-06-18 17:05 ` SZEDER Gábor
2021-06-18 17:50 ` Eric Sunshine
2021-06-19 6:06 ` Junio C Hamano
2021-06-20 13:53 ` Ævar Arnfjörð Bjarmason
2021-06-20 12:53 ` René Scharfe
2021-06-22 22:32 ` Johannes Schindelin
2021-06-29 0:32 ` Junio C Hamano
2021-06-29 17:53 ` René Scharfe [this message]
2021-06-29 18:53 ` [PATCH v2 0/3] Add a generated list of hooks in hook-list.h Ævar Arnfjörð Bjarmason
2021-06-29 18:54 ` [PATCH v2 1/3] hook.[ch]: move find_hook() to this new library Ævar Arnfjörð Bjarmason
2021-06-29 18:54 ` [PATCH v2 2/3] hook.c: add a hook_exists() wrapper and use it in bugreport.c Ævar Arnfjörð Bjarmason
2021-06-29 18:54 ` [PATCH v2 3/3] hook-list.h: add a generated list of hooks, like config-list.h Ævar Arnfjörð Bjarmason
2021-06-29 19:45 ` René Scharfe
2021-06-29 22:09 ` Ævar Arnfjörð Bjarmason
2021-07-09 20:29 ` Emily Shaffer
2021-07-10 9:03 ` Ævar Arnfjörð Bjarmason
2021-07-12 20:55 ` Emily Shaffer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20b1bfb6-8881-2a21-1753-0e2e508a7861@web.de \
--to=l.s.r@web.de \
--cc=Johannes.Schindelin@gmx.de \
--cc=avarab@gmail.com \
--cc=emilyshaffer@google.com \
--cc=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jeffhost@microsoft.com \
--cc=szeder.dev@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).