Skip to content

Commit 6d68e6a

Browse files
derrickstoleegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c00ba22 commit 6d68e6a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

builtin/multi-pack-index.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@ int cmd_multi_pack_index(int argc, const char **argv,
3232
opts.object_dir = get_object_directory();
3333

3434
if (argc == 0)
35-
goto usage;
35+
usage_with_options(builtin_multi_pack_index_usage,
36+
builtin_multi_pack_index_options);
3637

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+
}
4042

43+
if (!strcmp(argv[0], "write"))
4144
return write_midx_file(opts.object_dir);
42-
}
4345

44-
usage:
45-
usage_with_options(builtin_multi_pack_index_usage,
46-
builtin_multi_pack_index_options);
46+
die(_("unrecognized verb: %s"), argv[0]);
4747
}

0 commit comments

Comments
 (0)