diff options
| author | Usman Akinyemi <usmanakinyemi202@gmail.com> | 2025-03-08 05:05:02 +0530 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-03-07 16:52:01 -0800 |
| commit | db58d5a351031ec51817c1a6566ec5672ba17138 (patch) | |
| tree | d01b7d8e4992cd690f74788ebf39ef9c0259b2ac /t/t7510-signed-commit.sh | |
| parent | 43a839197795a7f0582efd66bc249dac89f86b68 (diff) | |
| download | git-db58d5a351031ec51817c1a6566ec5672ba17138.tar.gz | |
builtin/verify-commit: stop using `the_repository`
Remove the_repository global variable in favor of the repository
argument that gets passed in "builtin/verify-commit.c".
When `-h` is passed to the command outside a Git repository, the
`run_builtin()` will call the `cmd_verify_commit()` function with `repo`
set to NULL and then early in the function, `parse_options()` call will
give the options help and exit.
Pass the repository available in the calling context to `verify_commit()`
to remove it's dependency on the global `the_repository` variable.
Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7510-signed-commit.sh')
| -rwxr-xr-x | t/t7510-signed-commit.sh | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/t/t7510-signed-commit.sh b/t/t7510-signed-commit.sh index 0d2dd29fe6..39677e859a 100755 --- a/t/t7510-signed-commit.sh +++ b/t/t7510-signed-commit.sh @@ -8,6 +8,13 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME GNUPGHOME_NOT_USED=$GNUPGHOME . "$TEST_DIRECTORY/lib-gpg.sh" +test_expect_success GPG 'verify-commit does not crash with -h' ' + test_expect_code 129 git verify-commit -h >usage && + test_grep "[Uu]sage: git verify-commit " usage && + test_expect_code 129 nongit git verify-commit -h >usage && + test_grep "[Uu]sage: git verify-commit " usage +' + test_expect_success GPG 'create signed commits' ' test_oid_cache <<-\EOF && header sha1:gpgsig |
