]> git.ipfire.org Git - thirdparty/git.git/commitdiff
reflog: refactor cmd_reflog() to "if" branches
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Thu, 17 Mar 2022 18:08:34 +0000 (19:08 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 18 Mar 2022 01:03:11 +0000 (18:03 -0700)
Refactor the "if" branches in cmd_reflog() to use "else if" instead,
and remove the whitespace between them.

As with 92f480909f7 (multi-pack-index: refactor "goto usage" pattern,
2021-08-23) this makes this code more consistent with how
builtin/{bundle,stash,commit-graph,multi-pack-index}.c look and
behave. Their top-level commands are all similar sub-command routing
functions.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/reflog.c

index 9407f835cb6fe5c1d921b312a441eff84db961bf..c864f276308290ef9a3b3f0bbe7731a61bf0e207 100644 (file)
@@ -384,14 +384,11 @@ int cmd_reflog(int argc, const char **argv, const char *prefix)
 
        if (!strcmp(argv[1], "show"))
                return cmd_log_reflog(argc - 1, argv + 1, prefix);
-
-       if (!strcmp(argv[1], "expire"))
+       else if (!strcmp(argv[1], "expire"))
                return cmd_reflog_expire(argc - 1, argv + 1, prefix);
-
-       if (!strcmp(argv[1], "delete"))
+       else if (!strcmp(argv[1], "delete"))
                return cmd_reflog_delete(argc - 1, argv + 1, prefix);
-
-       if (!strcmp(argv[1], "exists"))
+       else if (!strcmp(argv[1], "exists"))
                return cmd_reflog_exists(argc - 1, argv + 1, prefix);
 
        return cmd_log_reflog(argc, argv, prefix);