Subject: Re: [PATCH 09/10] hook: show config scope in git hook list

From: Junio C Hamano <[email-masked]>
Date: Mon, 09 Mar 2026 14:59:04 -0700

Adrian Ratiu <[email-masked]> writes:

> +list [-z] [--show-scope]::
>  	Print a list of hooks which will be run on `<hook-name>` event. If no
>  	hooks are configured for that event, print a warning and return 1.
>  	Use `-z` to terminate output lines with NUL instead of newlines.
> ...
>  		case HOOK_CONFIGURED:
> -			printf("%s%c", h->u.configured.friendly_name, line_terminator);
> +			if (show_scope)
> +				printf("%s (%s)%c",
> +				       h->u.configured.friendly_name,
> +				       config_scope_name(h->u.configured.scope),
> +				       line_terminator);
> +			else
> +				printf("%s%c", h->u.configured.friendly_name,
> +				       line_terminator);
>  			break;

Everything in this patch was as expected (the most important of
which is where the data is kept, which is in the new structure
hook_config_cache_entry that was introduced in the previous step for
use case like this), except for the above bit.

I wonder if this already interacts well enough with "-z", or a minor
tweak would make it better?  Wouldn't a machine consumer expect that
friendly name and cope be given as two separate and easily parseable
fields in the same record?