Subject: Re: [PATCH 04/10] bugreport tests: tighten up "git bugreport -s hooks" test

From: Junio C Hamano <[email-masked]>
Date: Wed, 02 Mar 2022 13:22:59 -0800

Ævar Arnfjörð Bjarmason  <[email-masked]> writes:

> +	write_script .git/hooks/applypatch-msg <<-\EOF &&
> +	true
> +	EOF
> +	write_script .git/hooks/unknown-hook <<-\EOF &&
> +	true
> +	EOF
>  	git bugreport -s hooks &&
> +
>  	grep applypatch-msg git-bugreport-hooks.txt &&
> -	! grep prepare-commit-msg git-bugreport-hooks.txt
> +	! grep unknown-hook git-bugreport-hooks.txt &&
> +	! grep -F .sample git-bugreport-hooks.txt
>  '

The above is not wrong per-se, but because we control which hooks
are and are not visible to "git bugreport" we run in this test, I
wonder if we should do

	git bugreport -s tmp &&
	sed -ne '/^\[Enabled Hooks\]$/,/^$/p' git-bugreport-tmp.txt |
	sort >actual &&
	sort >expect <<-\EOF &&
	[Enabled Hooks]
	applypatch-msg
	EOF
	test_cmp expect actual

instead.  It is not like checking the "git help -a" output for list
of commands, which may grow or shrink as the system evolves.