Skip to content

Commit

Permalink
reset.c: replace switch by if-else
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Martin von Zweigbergk authored and Junio C Hamano committed Jan 15, 2013
1 parent 1ca38f8 commit b489097
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions builtin/reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,18 +349,11 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
* saving the previous head in ORIG_HEAD before. */
update_ref_status = update_refs(rev, sha1);

switch (reset_type) {
case HARD:
if (!update_ref_status && !quiet)
print_new_head_line(commit);
break;
case SOFT: /* Nothing else to do. */
break;
case MIXED: /* Report what has not been updated. */
if (reset_type == HARD && !update_ref_status && !quiet)
print_new_head_line(commit);
else if (reset_type == MIXED) /* Report what has not been updated. */
update_index_refresh(0, NULL,
quiet ? REFRESH_QUIET : REFRESH_IN_PORCELAIN);
break;
}

remove_branch_state();

Expand Down

0 comments on commit b489097

Please sign in to comment.