builtin/update-server-info: remove unnecessary if statement

Since we already teach the `repo_config()` in f29f1990 (config: teach repo_config to allow `repo` to be NULL, 2025-03-08) to allow `repo` to be NULL, no need to check if `repo` is NULL before calling `repo_config()`. Mentored-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Usman Akinyemi committed Apr 8, 2025 at 01:28 UTC 9ec327d922298f7adfa366c1d1ab2a795985c51e
2 files changed +9 -2
builtin/update-server-info.c
+2 -2
@@ -20,8 +20,8 @@ int cmd_update_server_info(int argc,
20 OPT_END()
21 };
22
23 - if (repo)
24 - repo_config(repo, git_default_config, NULL);
23 + repo_config(repo, git_default_config, NULL);
24 +
25 argc = parse_options(argc, argv, prefix, options,
26 update_server_info_usage, 0);
27 if (argc > 0)
t/t1517-outside-repo.sh
+7
@@ -107,4 +107,11 @@ test_expect_success LIBCURL 'remote-http outside repository' '
107 test_grep "^error: remote-curl" actual
108 '
109
110 +test_expect_success 'update-server-info does not crash with -h' '
111 + test_expect_code 129 git update-server-info -h >usage &&
112 + test_grep "[Uu]sage: git update-server-info " usage &&
113 + test_expect_code 129 nongit git update-server-info -h >usage &&
114 + test_grep "[Uu]sage: git update-server-info " usage
115 +'
116 +
117 test_done