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 <martinvonz@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Martin von Zweigbergk committed
Jan 14, 2013 at 21:47 UTC
b489097e1dbff7764e35ee260f8397d62a70fbb5
1 file changed
+3
-10
builtin/reset.c
+3
-10
@@ -349,18 +349,11 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
349
* saving the previous head in ORIG_HEAD before. */
350
update_ref_status = update_refs(rev, sha1);
351
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. */
355
update_index_refresh(0, NULL,
356
quiet ? REFRESH_QUIET : REFRESH_IN_PORCELAIN);
362
- break;
363
- }
357
358
remove_branch_state();
359