summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-07-28 20:18:04 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-07-28 20:18:04 (GMT)
commit7f554a4f694dc5e9a3cb42887546a121ff9d2b93 (patch)
tree37214dbf4da7779338af9a7156dae1eb31f99be2
parentaaf113ed95f58d83a81ccdaf32e41a5d8f1d98cf (diff)
parent88617d11f9d2ee1ea726cef4527d676a9a46fa63 (diff)
downloadgit-7f554a4f694dc5e9a3cb42887546a121ff9d2b93.zip
git-7f554a4f694dc5e9a3cb42887546a121ff9d2b93.tar.gz
git-7f554a4f694dc5e9a3cb42887546a121ff9d2b93.tar.bz2
Merge branch 'tb/reverse-midx'
The code that gives an error message in "git multi-pack-index" when no subcommand is given tried to print a NULL pointer as a strong, which has been corrected. * tb/reverse-midx: multi-pack-index: fix potential segfault without sub-command
-rw-r--r--builtin/multi-pack-index.c2
-rwxr-xr-xt/t5319-multi-pack-index.sh5
2 files changed, 6 insertions, 1 deletions
diff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c
index 5d3ea44..8ff0dee 100644
--- a/builtin/multi-pack-index.c
+++ b/builtin/multi-pack-index.c
@@ -176,8 +176,8 @@ int cmd_multi_pack_index(int argc, const char **argv,
else if (!strcmp(argv[0], "expire"))
return cmd_multi_pack_index_expire(argc, argv);
else {
-usage:
error(_("unrecognized subcommand: %s"), argv[0]);
+usage:
usage_with_options(builtin_multi_pack_index_usage,
builtin_multi_pack_index_options);
}
diff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh
index 7609f1e..3d4d9f1 100755
--- a/t/t5319-multi-pack-index.sh
+++ b/t/t5319-multi-pack-index.sh
@@ -837,4 +837,9 @@ test_expect_success 'load reverse index when missing .idx, .pack' '
)
'
+test_expect_success 'usage shown without sub-command' '
+ test_expect_code 129 git multi-pack-index 2>err &&
+ ! test_i18ngrep "unrecognized subcommand" err
+'
+
test_done