From: Ævar Arnfjörð Bjarmason Date: Mon, 15 Feb 2021 18:41:17 GMT Subject: [PATCH 4/5] commit-graph: refactor dispatch loop for style Message-ID: <20210215184118.11306-5-avarab@gmail.com> In-Reply-To: <87r1lhb6z7.fsf@evledraar.gmail.com> I think it's more readable to have one if/elsif/else chain here than the code this replaces. Signed-off-by: Ævar Arnfjörð Bjarmason --- builtin/commit-graph.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c index a7718b2025..66fbdb7cb1 100644 --- a/builtin/commit-graph.c +++ b/builtin/commit-graph.c @@ -334,13 +334,11 @@ int cmd_commit_graph(int argc, const char **argv, const char *prefix) save_commit_buffer = 0; - if (argc > 0) { - if (!strcmp(argv[0], "verify")) - return graph_verify(argc, argv); - if (!strcmp(argv[0], "write")) - return graph_write(argc, argv); - } - - usage_with_options(builtin_commit_graph_usage, - builtin_commit_graph_options); + if (argc && !strcmp(argv[0], "verify")) + return graph_verify(argc, argv); + else if (argc && !strcmp(argv[0], "write")) + return graph_write(argc, argv); + else + usage_with_options(builtin_commit_graph_usage, + builtin_commit_graph_options); } -- 2.30.0.284.gd98b1dd5eaa7