OSDN Git Service

branch.c: install_branch_config: simplify if chain
authorAdam <adam@sigterm.info>
Mon, 10 Mar 2014 05:32:01 +0000 (01:32 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 24 Mar 2014 19:43:07 +0000 (12:43 -0700)
Simplify if chain in install_branch_config().

Signed-off-by: Adam <Adam@sigterm.info>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
branch.c

index 723a36b..b2d59f1 100644 (file)
--- a/branch.c
+++ b/branch.c
@@ -77,29 +77,29 @@ void install_branch_config(int flag, const char *local, const char *origin, cons
        strbuf_release(&key);
 
        if (flag & BRANCH_CONFIG_VERBOSE) {
-               if (remote_is_branch && origin)
-                       printf_ln(rebasing ?
-                                 _("Branch %s set up to track remote branch %s from %s by rebasing.") :
-                                 _("Branch %s set up to track remote branch %s from %s."),
-                                 local, shortname, origin);
-               else if (remote_is_branch && !origin)
-                       printf_ln(rebasing ?
-                                 _("Branch %s set up to track local branch %s by rebasing.") :
-                                 _("Branch %s set up to track local branch %s."),
-                                 local, shortname);
-               else if (!remote_is_branch && origin)
-                       printf_ln(rebasing ?
-                                 _("Branch %s set up to track remote ref %s by rebasing.") :
-                                 _("Branch %s set up to track remote ref %s."),
-                                 local, remote);
-               else if (!remote_is_branch && !origin)
-                       printf_ln(rebasing ?
-                                 _("Branch %s set up to track local ref %s by rebasing.") :
-                                 _("Branch %s set up to track local ref %s."),
-                                 local, remote);
-               else
-                       die("BUG: impossible combination of %d and %p",
-                           remote_is_branch, origin);
+               if (remote_is_branch) {
+                       if (origin)
+                               printf_ln(rebasing ?
+                                         _("Branch %s set up to track remote branch %s from %s by rebasing.") :
+                                         _("Branch %s set up to track remote branch %s from %s."),
+                                         local, shortname, origin);
+                       else
+                               printf_ln(rebasing ?
+                                         _("Branch %s set up to track local branch %s by rebasing.") :
+                                         _("Branch %s set up to track local branch %s."),
+                                         local, shortname);
+               } else {
+                       if (origin)
+                               printf_ln(rebasing ?
+                                         _("Branch %s set up to track remote ref %s by rebasing.") :
+                                         _("Branch %s set up to track remote ref %s."),
+                                         local, remote);
+                       else
+                               printf_ln(rebasing ?
+                                         _("Branch %s set up to track local ref %s by rebasing.") :
+                                         _("Branch %s set up to track local ref %s."),
+                                         local, remote);
+               }
        }
 }