Skip to content

Commit 5f9b64a

Browse files
avargitster
authored andcommitted
reflog: refactor cmd_reflog() to "if" branches
Refactor the "if" branches in cmd_reflog() to use "else if" instead, and remove the whitespace between them. As with 92f4809 (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 03df6cb commit 5f9b64a

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

builtin/reflog.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -384,14 +384,11 @@ int cmd_reflog(int argc, const char **argv, const char *prefix)
384384

385385
if (!strcmp(argv[1], "show"))
386386
return cmd_log_reflog(argc - 1, argv + 1, prefix);
387-
388-
if (!strcmp(argv[1], "expire"))
387+
else if (!strcmp(argv[1], "expire"))
389388
return cmd_reflog_expire(argc - 1, argv + 1, prefix);
390-
391-
if (!strcmp(argv[1], "delete"))
389+
else if (!strcmp(argv[1], "delete"))
392390
return cmd_reflog_delete(argc - 1, argv + 1, prefix);
393-
394-
if (!strcmp(argv[1], "exists"))
391+
else if (!strcmp(argv[1], "exists"))
395392
return cmd_reflog_exists(argc - 1, argv + 1, prefix);
396393

397394
return cmd_log_reflog(argc, argv, prefix);

0 commit comments

Comments
 (0)