aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-04-17 10:28:18 -0700
committerJunio C Hamano <gitster@pobox.com>2025-04-17 10:28:19 -0700
commit72801dfde18a0752ec4fe1168e0e47d41166ce7d (patch)
tree424364e679d9eb44131957328a8de9cc499dbfa8
parentc3ebf18eb2deac595bd2550c1076247d8cbf2bc1 (diff)
parent9ec327d922298f7adfa366c1d1ab2a795985c51e (diff)
downloadgit-72801dfde18a0752ec4fe1168e0e47d41166ce7d.tar.gz
Merge branch 'ua/update-update-server-info'
Code simplification. * ua/update-update-server-info: builtin/update-server-info: remove unnecessary if statement
-rw-r--r--builtin/update-server-info.c4
-rwxr-xr-xt/t1517-outside-repo.sh7
2 files changed, 9 insertions, 2 deletions
diff --git a/builtin/update-server-info.c b/builtin/update-server-info.c
index d7467290a8..ba702d30ef 100644
--- a/builtin/update-server-info.c
+++ b/builtin/update-server-info.c
@@ -20,8 +20,8 @@ int cmd_update_server_info(int argc,
OPT_END()
};
- if (repo)
- repo_config(repo, git_default_config, NULL);
+ repo_config(repo, git_default_config, NULL);
+
argc = parse_options(argc, argv, prefix, options,
update_server_info_usage, 0);
if (argc > 0)
diff --git a/t/t1517-outside-repo.sh b/t/t1517-outside-repo.sh
index dbd8cd6906..6824581317 100755
--- a/t/t1517-outside-repo.sh
+++ b/t/t1517-outside-repo.sh
@@ -107,4 +107,11 @@ test_expect_success LIBCURL 'remote-http outside repository' '
test_grep "^error: remote-curl" actual
'
+test_expect_success 'update-server-info does not crash with -h' '
+ test_expect_code 129 git update-server-info -h >usage &&
+ test_grep "[Uu]sage: git update-server-info " usage &&
+ test_expect_code 129 nongit git update-server-info -h >usage &&
+ test_grep "[Uu]sage: git update-server-info " usage
+'
+
test_done