Move `git_config()` call after `usage_with_options()` to avoid NULL `repo` check. When "-h" is passed to builtins using the RUN_SETUP macro, `repo` passed by `run_builtin()` will be NULL. If we use the `repo` instead of the global `the_repository` variable. We will have to switch from `git_config()` to `repo_config()` which takes in `repo`. We must check for NULL `repo` if `repo_config()` comes before `usage_with_options()`. Moving `git_config()` after `usage_with_options()` eliminates this need, as `usage_with_options()` exit before calling `repo_config()`. This will be useful in the following patch which remove `the_repository` global variable in favor of the `repo` passed by `run_builtin()`. Mentored-by: Christian Couder <chriscool@xxxxxxxxxxxxx> Signed-off-by: Usman Akinyemi <usmanakinyemi202@xxxxxxxxx> --- builtin/verify-tag.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/verify-tag.c b/builtin/verify-tag.c index f6b97048a5..f0e7c2a2b5 100644 --- a/builtin/verify-tag.c +++ b/builtin/verify-tag.c @@ -35,8 +35,6 @@ int cmd_verify_tag(int argc, OPT_END() }; - git_config(git_default_config, NULL); - argc = parse_options(argc, argv, prefix, verify_tag_options, verify_tag_usage, PARSE_OPT_KEEP_ARGV0); if (argc <= i) @@ -52,6 +50,8 @@ int cmd_verify_tag(int argc, flags |= GPG_VERIFY_OMIT_STATUS; } + git_config(git_default_config, NULL); + while (i < argc) { struct object_id oid; const char *name = argv[i++]; -- 2.48.1