From: Emily Shaffer <emilyshaffer@google.com>
To: Jonathan Tan <jonathantanmy@google.com>
Cc: git@vger.kernel.org
Subject: Re: [RFC PATCH 1/2] hook: move list of hooks
Date: Fri, 18 Jun 2021 13:59:39 -0700 [thread overview]
Message-ID: <YM0JOyxPGYmzynoc@google.com> (raw)
In-Reply-To: <74ed668e9bbf56bb7898bcdfaaf77db4f3205fe5.1623881977.git.jonathantanmy@google.com>
On Wed, Jun 16, 2021 at 04:31:48PM -0700, Jonathan Tan wrote:
>
> The list of hooks will need to be used outside bugreport, so move it to
> a central location.
Hm, does this fight with
https://lore.kernel.org/git/cover-0.3-0000000000-20210617T100239Z-avarab@gmail.com
?
This patch itself looks pretty straightforward, but I think it is a good
idea to take a look at avarab's change first.
- Emily
>
> Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
> ---
> builtin/bugreport.c | 38 +++-----------------------------------
> hook.c | 34 ++++++++++++++++++++++++++++++++++
> hook.h | 3 +++
> 3 files changed, 40 insertions(+), 35 deletions(-)
>
> diff --git a/builtin/bugreport.c b/builtin/bugreport.c
> index 190272ba70..4e0806dff3 100644
> --- a/builtin/bugreport.c
> +++ b/builtin/bugreport.c
> @@ -41,38 +41,6 @@ static void get_system_info(struct strbuf *sys_info)
>
> static void get_populated_hooks(struct strbuf *hook_info, int nongit)
> {
> - /*
> - * NEEDSWORK: Doesn't look like there is a list of all possible hooks;
> - * so below is a transcription of `git help hooks`. Later, this should
> - * be replaced with some programmatically generated list (generated from
> - * doc or else taken from some library which tells us about all the
> - * hooks)
> - */
> - static const char *hook[] = {
> - "applypatch-msg",
> - "pre-applypatch",
> - "post-applypatch",
> - "pre-commit",
> - "pre-merge-commit",
> - "prepare-commit-msg",
> - "commit-msg",
> - "post-commit",
> - "pre-rebase",
> - "post-checkout",
> - "post-merge",
> - "pre-push",
> - "pre-receive",
> - "update",
> - "post-receive",
> - "post-update",
> - "push-to-checkout",
> - "pre-auto-gc",
> - "post-rewrite",
> - "sendemail-validate",
> - "fsmonitor-watchman",
> - "p4-pre-submit",
> - "post-index-change",
> - };
> int i;
>
> if (nongit) {
> @@ -81,9 +49,9 @@ static void get_populated_hooks(struct strbuf *hook_info, int nongit)
> return;
> }
>
> - for (i = 0; i < ARRAY_SIZE(hook); i++)
> - if (hook_exists(hook[i], HOOKDIR_USE_CONFIG))
> - strbuf_addf(hook_info, "%s\n", hook[i]);
> + for (i = 0; i < hook_name_count; i++)
> + if (hook_exists(hook_name[i], HOOKDIR_USE_CONFIG))
> + strbuf_addf(hook_info, "%s\n", hook_name[i]);
> }
>
> static const char * const bugreport_usage[] = {
> diff --git a/hook.c b/hook.c
> index ff80e52edd..3ccacb72fa 100644
> --- a/hook.c
> +++ b/hook.c
> @@ -5,6 +5,40 @@
> #include "run-command.h"
> #include "prompt.h"
>
> +/*
> + * NEEDSWORK: Doesn't look like there is a list of all possible hooks;
> + * so below is a transcription of `git help hooks`. Later, this should
> + * be replaced with some programmatically generated list (generated from
> + * doc or else taken from some library which tells us about all the
> + * hooks)
> + */
> +const char *hook_name[] = {
> + "applypatch-msg",
> + "pre-applypatch",
> + "post-applypatch",
> + "pre-commit",
> + "pre-merge-commit",
> + "prepare-commit-msg",
> + "commit-msg",
> + "post-commit",
> + "pre-rebase",
> + "post-checkout",
> + "post-merge",
> + "pre-push",
> + "pre-receive",
> + "update",
> + "post-receive",
> + "post-update",
> + "push-to-checkout",
> + "pre-auto-gc",
> + "post-rewrite",
> + "sendemail-validate",
> + "fsmonitor-watchman",
> + "p4-pre-submit",
> + "post-index-change",
> +};
> +int hook_name_count = ARRAY_SIZE(hook_name);
> +
> void free_hook(struct hook *ptr)
> {
> if (ptr) {
> diff --git a/hook.h b/hook.h
> index f32189380a..d902166408 100644
> --- a/hook.h
> +++ b/hook.h
> @@ -4,6 +4,9 @@
> #include "strvec.h"
> #include "run-command.h"
>
> +extern const char *hook_name[];
> +extern int hook_name_count;
> +
> struct hook {
> struct list_head list;
> /*
> --
> 2.32.0.272.g935e593368-goog
>
next prev parent reply other threads:[~2021-06-18 20:59 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-16 23:31 [RFC PATCH 0/2] MVP implementation of remote-suggested hooks Jonathan Tan
2021-06-16 23:31 ` [RFC PATCH 1/2] hook: move list of hooks Jonathan Tan
2021-06-18 20:59 ` Emily Shaffer [this message]
2021-06-18 21:48 ` Jonathan Tan
2021-06-16 23:31 ` [RFC PATCH 2/2] clone,fetch: remote-suggested auto-updating hooks Jonathan Tan
2021-06-18 21:32 ` Emily Shaffer
2021-06-17 1:30 ` [RFC PATCH 0/2] MVP implementation of remote-suggested hooks Junio C Hamano
2021-06-18 21:46 ` Jonathan Tan
2021-06-18 20:57 ` Emily Shaffer
2021-06-18 21:58 ` Jonathan Tan
2021-06-18 22:32 ` Randall S. Becker
2021-06-19 7:58 ` Matt Rogers
2021-06-21 18:37 ` Jonathan Tan
2021-06-20 19:51 ` Ævar Arnfjörð Bjarmason
2021-06-21 18:58 ` Jonathan Tan
2021-06-21 19:35 ` Ævar Arnfjörð Bjarmason
2021-06-22 1:27 ` Jonathan Tan
2021-06-22 0:40 ` brian m. carlson
2021-06-23 22:58 ` Jonathan Tan
2021-06-24 23:11 ` brian m. carlson
2021-06-28 23:12 ` Junio C Hamano
2021-07-16 17:57 ` [RFC PATCH v2 " Jonathan Tan
2021-07-16 17:57 ` [RFC PATCH v2 1/2] hook: move list of hooks Jonathan Tan
2021-07-16 17:57 ` [RFC PATCH v2 2/2] hook: remote-suggested hooks Jonathan Tan
2021-07-19 21:28 ` Junio C Hamano
2021-07-20 21:11 ` Jonathan Tan
2021-07-20 21:28 ` Phil Hord
2021-07-20 21:56 ` Jonathan Tan
2021-07-20 20:55 ` Ævar Arnfjörð Bjarmason
2021-07-20 21:48 ` Jonathan Tan
2021-07-27 0:57 ` Emily Shaffer
2021-07-27 1:29 ` Junio C Hamano
2021-07-27 21:39 ` Jonathan Tan
2021-07-27 22:40 ` Junio C Hamano
2021-07-19 21:06 ` [RFC PATCH v2 0/2] MVP implementation of " Junio C Hamano
2021-07-20 20:49 ` Jonathan Tan
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YM0JOyxPGYmzynoc@google.com \
--to=emilyshaffer@google.com \
--cc=git@vger.kernel.org \
--cc=jonathantanmy@google.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.
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 NNTP newsgroup(s).