]> git.ipfire.org Git - thirdparty/git.git/commit
hook: show disabled hooks in "git hook list"
authorAdrian Ratiu <adrian.ratiu@collabora.com>
Wed, 25 Mar 2026 19:55:02 +0000 (21:55 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 25 Mar 2026 21:00:47 +0000 (14:00 -0700)
commite17bd99281ae01a758d717bdfaa759bbeefb6149
treea3d9a8c28b5d133eafd6038f2b099138f984cff5
parentb66efad2b1f53755a80699dc39f94e2b15d6af67
hook: show disabled hooks in "git hook list"

Disabled hooks were filtered out of the cache entirely, making them
invisible to "git hook list". Keep them in the cache with a new
"disabled" flag which is propagated to the respective struct hook.

"git hook list" now shows disabled hooks as tab-separated columns,
with the status as a prefix before the name (like scope with
--show-scope). With --show-scope it looks like:

$ git hook list --show-scope pre-commit
global linter
local disabled no-leaks
hook from hookdir

A disabled hook without a command issues a warning instead of the
fatal "hook.X.command must be configured" error. We could also throw
an error, however it seemd a bit excessive to me in this case.

Suggested-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/hook.c
hook.c
hook.h
t/t1800-hook.sh