Subject: Re: [PATCH v3 2/8] builtin/verify-tag: stop using `the_repository`

From: Junio C Hamano <[email-masked]>
Date: Thu, 06 Mar 2025 09:56:38 -0800

Usman Akinyemi <[email-masked]> writes:

> When `-h` is passed to the command outside a Git repository, the
> `run_builtin()` will call the `cmd_verify_tag()` function with `repo` set
> to NULL and then early in the function, `parse_options()` call will give
> the options help and exit.

Makes sense.

> diff --git a/t/t7030-verify-tag.sh b/t/t7030-verify-tag.sh
> index 6f526c37c2..2c147072c1 100755
> --- a/t/t7030-verify-tag.sh
> +++ b/t/t7030-verify-tag.sh
> @@ -7,6 +7,13 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
>  . ./test-lib.sh
>  . "$TEST_DIRECTORY/lib-gpg.sh"
>  
> +test_expect_success GPG 'verify-tag does not crash with -h' '
> +	test_expect_code 129 git verify-tag -h >usage &&
> +	test_grep "[Uu]sage: git verify-tag " usage &&
> +	test_expect_code 129 nongit git verify-tag -h >usage &&
> +	test_grep "[Uu]sage: git verify-tag " usage
> +'

OK.  I am not sure if we want to insist that the "-h" invocation
exits with status 129, but changing it would be totaly outside the
topic.

Will queue.