From: Junio C Hamano Date: Mon, 18 Nov 2013 20:24:49 +0000 (-0800) Subject: Merge branch 'jx/branch-vv-always-compare-with-upstream' X-Git-Tag: v1.8.5-rc3~5 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/ab930f02961bd4cce9b3dd5049c6eabd07ca03a8?ds=inline;hp=-c Merge branch 'jx/branch-vv-always-compare-with-upstream' Hot-fix for a regression. * jx/branch-vv-always-compare-with-upstream: branch: fix --verbose output column alignment --- ab930f02961bd4cce9b3dd5049c6eabd07ca03a8 diff --combined builtin/branch.c index 5696cf0ef7,a8f59ef30d..f157f92f48 --- a/builtin/branch.c +++ b/builtin/branch.c @@@ -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: @@@ -451,9 -452,13 +452,13 @@@ 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); @@@ -474,7 -479,8 +479,8 @@@ 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), @@@ -828,10 -834,10 +834,10 @@@ 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, @@@ -878,8 -884,7 +884,8 @@@ 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) @@@ -975,8 -980,9 +981,8 @@@ 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);