commit-graph: early exit to "usage" on !argc

Rather than guarding all of the !argc with an additional "if" arm
let's do an early goto to "usage". This also makes it clear that
"save_commit_buffer" is not needed in this case.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Ævar Arnfjörð Bjarmason 2021-08-23 14:30:19 +02:00 committed by Junio C Hamano
parent 92f480909f
commit 070e7c5619
1 changed files with 7 additions and 6 deletions

View File

@ -331,16 +331,17 @@ int cmd_commit_graph(int argc, const char **argv, const char *prefix)
builtin_commit_graph_options, builtin_commit_graph_options,
builtin_commit_graph_usage, builtin_commit_graph_usage,
PARSE_OPT_STOP_AT_NON_OPTION); PARSE_OPT_STOP_AT_NON_OPTION);
if (!argc)
goto usage;


save_commit_buffer = 0; save_commit_buffer = 0;


if (argc > 0) { if (!strcmp(argv[0], "verify"))
if (!strcmp(argv[0], "verify")) return graph_verify(argc, argv);
return graph_verify(argc, argv); else if (argc && !strcmp(argv[0], "write"))
if (!strcmp(argv[0], "write")) return graph_write(argc, argv);
return graph_write(argc, argv);
}


usage:
usage_with_options(builtin_commit_graph_usage, usage_with_options(builtin_commit_graph_usage,
builtin_commit_graph_options); builtin_commit_graph_options);
} }