multi-pack-index: provide more helpful usage info
The multi-pack-index builtin has a very simple command-line interface. Instead of simply reporting usage, give the user a hint to why the arguments failed. Reported-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Derrick Stolee committed
Aug 20, 2018 at 16:51 UTC
6d68e6a46174746d95373a47ab4ef4f57aa56d22
1 file changed
+8
-8
builtin/multi-pack-index.c
+8
-8
@@ -32,16 +32,16 @@ int cmd_multi_pack_index(int argc, const char **argv,
32
opts.object_dir = get_object_directory();
33
34
if (argc == 0)
35
- goto usage;
35
+ usage_with_options(builtin_multi_pack_index_usage,
36
+ builtin_multi_pack_index_options);
37
37
- if (!strcmp(argv[0], "write")) {
38
- if (argc > 1)
39
- goto usage;
38
+ if (argc > 1) {
39
+ die(_("too many arguments"));
40
+ return 1;
41
+ }
42
43
+ if (!strcmp(argv[0], "write"))
44
return write_midx_file(opts.object_dir);
42
- }
45
44
-usage:
45
- usage_with_options(builtin_multi_pack_index_usage,
46
- builtin_multi_pack_index_options);
46
+ die(_("unrecognized verb: %s"), argv[0]);
47
}