Skip to content

Commit b489097

Browse files
martinvonzgitster
authored andcommitted
reset.c: replace switch by if-else
The switch statement towards the end of reset.c is missing case arms for KEEP and MERGE for no obvious reason, and soon the only non-empty case arm will be the one for HARD. So let's proactively replace it by if-else, which will let us move one if statement out without leaving funny-looking left-overs. Signed-off-by: Martin von Zweigbergk <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1ca38f8 commit b489097

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

builtin/reset.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -349,18 +349,11 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
349349
* saving the previous head in ORIG_HEAD before. */
350350
update_ref_status = update_refs(rev, sha1);
351351

352-
switch (reset_type) {
353-
case HARD:
354-
if (!update_ref_status && !quiet)
355-
print_new_head_line(commit);
356-
break;
357-
case SOFT: /* Nothing else to do. */
358-
break;
359-
case MIXED: /* Report what has not been updated. */
352+
if (reset_type == HARD && !update_ref_status && !quiet)
353+
print_new_head_line(commit);
354+
else if (reset_type == MIXED) /* Report what has not been updated. */
360355
update_index_refresh(0, NULL,
361356
quiet ? REFRESH_QUIET : REFRESH_IN_PORCELAIN);
362-
break;
363-
}
364357

365358
remove_branch_state();
366359

0 commit comments

Comments
 (0)