From: Junio C Hamano Date: Wed, 6 May 2015 04:00:25 +0000 (-0700) Subject: Merge branch 'mh/show-branch-topic' X-Git-Tag: v2.5.0-rc0~158 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/b02a94d6631bd2169d11d3dc7d2ebc21e2dfca30?hp=-c Merge branch 'mh/show-branch-topic' "git show-branch --topics HEAD" (with no other arguments) did not do anything interesting. Instead, contrast the given revision against all the local branches by default. * mh/show-branch-topic: show-branch: show all local heads when only giving one rev along --topics --- b02a94d6631bd2169d11d3dc7d2ebc21e2dfca30 diff --combined builtin/show-branch.c index f3fb5fb2bf,ef9e719b0f..e69fb7c489 --- a/builtin/show-branch.c +++ b/builtin/show-branch.c @@@ -6,11 -6,11 +6,11 @@@ #include "parse-options.h" static const char* show_branch_usage[] = { - N_("git show-branch [-a|--all] [-r|--remotes] [--topo-order | --date-order]\n" + N_("git show-branch [-a | --all] [-r | --remotes] [--topo-order | --date-order]\n" " [--current] [--color[=] | --no-color] [--sparse]\n" " [--more= | --list | --independent | --merge-base]\n" " [--no-name | --sha1-name] [--topics] [( | )...]"), - N_("git show-branch (-g|--reflog)[=[,]] [--list] []"), + N_("git show-branch (-g | --reflog)[=[,]] [--list] []"), NULL }; @@@ -718,7 -718,7 +718,7 @@@ int cmd_show_branch(int ac, const char } /* If nothing is specified, show all branches by default */ - if (ac + all_heads + all_remotes == 0) + if (ac <= topics && all_heads + all_remotes == 0) all_heads = 1; if (reflog) { @@@ -785,13 -785,13 +785,13 @@@ } free(ref); } - else if (all_heads + all_remotes) - snarf_refs(all_heads, all_remotes); else { while (0 < ac) { append_one_rev(*av); ac--; av++; } + if (all_heads + all_remotes) + snarf_refs(all_heads, all_remotes); } head_p = resolve_ref_unsafe("HEAD", RESOLVE_REF_READING,