Merge branch 'jx/branch-vv-always-compare-with-upstream'
authorJunio C Hamano <gitster@pobox.com>
Mon, 18 Nov 2013 20:24:49 +0000 (12:24 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 18 Nov 2013 20:24:49 +0000 (12:24 -0800)
Hot-fix for a regression.

* jx/branch-vv-always-compare-with-upstream:
branch: fix --verbose output column alignment

1  2 
builtin/branch.c
diff --combined builtin/branch.c
index 5696cf0ef79cd8242e0a384a058d5bd565ec5be3,a8f59ef30dfeca9e7b3d659bbd2d9e25e3cf57ec..f157f92f485230c2412454def728d374550497be
@@@ -424,6 -424,7 +424,7 @@@ static void fill_tracking_info(struct s
        struct branch *branch = branch_get(branch_name);
        struct strbuf fancy = STRBUF_INIT;
        int upstream_is_gone = 0;
+       int added_decoration = 1;
  
        switch (stat_tracking_info(branch, &ours, &theirs)) {
        case 0:
        if (upstream_is_gone) {
                if (show_upstream_ref)
                        strbuf_addf(stat, _("[%s: gone]"), fancy.buf);
+               else
+                       added_decoration = 0;
        } else if (!ours && !theirs) {
                if (show_upstream_ref)
                        strbuf_addf(stat, _("[%s]"), fancy.buf);
+               else
+                       added_decoration = 0;
        } else if (!ours) {
                if (show_upstream_ref)
                        strbuf_addf(stat, _("[%s: behind %d]"), fancy.buf, theirs);
                                    ours, theirs);
        }
        strbuf_release(&fancy);
-       strbuf_addch(stat, ' ');
+       if (added_decoration)
+               strbuf_addch(stat, ' ');
        free(ref);
  }
  
@@@ -803,7 -809,7 +809,7 @@@ int cmd_branch(int argc, const char **a
                OPT_SET_INT( 0, "set-upstream",  &track, N_("change upstream info"),
                        BRANCH_TRACK_OVERRIDE),
                OPT_STRING('u', "set-upstream-to", &new_upstream, "upstream", "change the upstream info"),
 -              OPT_BOOLEAN(0, "unset-upstream", &unset_upstream, "Unset the upstream info"),
 +              OPT_BOOL(0, "unset-upstream", &unset_upstream, "Unset the upstream info"),
                OPT__COLOR(&branch_use_color, N_("use colored output")),
                OPT_SET_INT('r', "remotes",     &kinds, N_("act on remote-tracking branches"),
                        REF_REMOTE_BRANCH),
                OPT_BIT('D', NULL, &delete, N_("delete branch (even if not merged)"), 2),
                OPT_BIT('m', "move", &rename, N_("move/rename a branch and its reflog"), 1),
                OPT_BIT('M', NULL, &rename, N_("move/rename a branch, even if target exists"), 2),
 -              OPT_BOOLEAN(0, "list", &list, N_("list branch names")),
 -              OPT_BOOLEAN('l', "create-reflog", &reflog, N_("create the branch's reflog")),
 -              OPT_BOOLEAN(0, "edit-description", &edit_description,
 -                          N_("edit the description for the branch")),
 +              OPT_BOOL(0, "list", &list, N_("list branch names")),
 +              OPT_BOOL('l', "create-reflog", &reflog, N_("create the branch's reflog")),
 +              OPT_BOOL(0, "edit-description", &edit_description,
 +                       N_("edit the description for the branch")),
                OPT__FORCE(&force_create, N_("force creation (when already exists)")),
                {
                        OPTION_CALLBACK, 0, "no-merged", &merge_filter_ref,
        if (with_commit || merge_filter != NO_FILTER)
                list = 1;
  
 -      if (!!delete + !!rename + !!force_create + !!list + !!new_upstream + !!unset_upstream > 1)
 +      if (!!delete + !!rename + !!force_create + !!new_upstream +
 +          list + unset_upstream > 1)
                usage_with_options(builtin_branch_usage, options);
  
        if (abbrev == -1)
                        die(_("no such branch '%s'"), argv[0]);
                }
  
 -              if (!branch_has_merge_config(branch)) {
 +              if (!branch_has_merge_config(branch))
                        die(_("Branch '%s' has no upstream information"), branch->name);
 -              }
  
                strbuf_addf(&buf, "branch.%s.remote", branch->name);
                git_config_set_multivar(buf.buf, NULL, NULL, 1);