aboutsummaryrefslogtreecommitdiff
path: root/builtin/reset.c
diff options
context:
space:
mode:
authorMartin von Zweigbergk <martinvonz@gmail.com>2013-01-14 21:47:43 -0800
committerJunio C Hamano <gitster@pobox.com>2013-01-15 09:38:08 -0800
commitb489097e1dbff7764e35ee260f8397d62a70fbb5 (patch)
treea0fcc9acc5a49fa834ff6a386059593d5b15b55b /builtin/reset.c
parent1ca38f85860b33ddc79b1494baf29aecde8616cd (diff)
downloadgit-b489097e1dbff7764e35ee260f8397d62a70fbb5.tar.gz
git-b489097e1dbff7764e35ee260f8397d62a70fbb5.tar.xz
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>
Diffstat (limited to 'builtin/reset.c')
-rw-r--r--builtin/reset.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/builtin/reset.c b/builtin/reset.c
index 97fa9f785..c3eb2eb48 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -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();