summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2021-07-28 13:18:04 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-07-28 13:18:04 -0700
commit7f554a4f694dc5e9a3cb42887546a121ff9d2b93 (patch)
tree37214dbf4da7779338af9a7156dae1eb31f99be2
parentMerge branch 'hn/refs-debug-empty-prefix' (diff)
parentmulti-pack-index: fix potential segfault without sub-command (diff)
downloadtgif-7f554a4f694dc5e9a3cb42887546a121ff9d2b93.tar.xz
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 5d3ea445fd..8ff0dee2ec 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 7609f1ea64..3d4d9f10c3 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