Currently, there is no way to invoke the list mode with a pattern because this is interpreted as branch creation. Introduce a --list argument which invokes the list mode. Signed-off-by: Michael J Gruber <git@xxxxxxxxxxxxxxxxxxxx> --- builtin/branch.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/builtin/branch.c b/builtin/branch.c index 10292ab..4ccd89c 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -619,7 +619,7 @@ static int opt_parse_merge_filter(const struct option *opt, const char *arg, int int cmd_branch(int argc, const char **argv, const char *prefix) { - int delete = 0, rename = 0, force_create = 0; + int delete = 0, rename = 0, force_create = 0, list = 0; int verbose = 0, abbrev = DEFAULT_ABBREV, detached = 0; int reflog = 0; enum branch_track track; @@ -658,6 +658,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix) OPT_BIT('D', NULL, &delete, "delete branch (even if not merged)", 2), OPT_BIT('m', NULL, &rename, "move/rename a branch and its reflog", 1), OPT_BIT('M', NULL, &rename, "move/rename a branch, even if target exists", 2), + OPT_BOOLEAN(0, "list", &list, "list branch names"), OPT_BOOLEAN('l', NULL, &reflog, "create the branch's reflog"), OPT__FORCE(&force_create, "force creation (when already exists)"), { @@ -700,12 +701,15 @@ int cmd_branch(int argc, const char **argv, const char *prefix) argc = parse_options(argc, argv, prefix, options, builtin_branch_usage, 0); - if (!!delete + !!rename + !!force_create > 1) + if (!!delete + !!rename + !!force_create + !!list > 1) usage_with_options(builtin_branch_usage, options); + if (argc == 0 || (verbose && argc == 1)) + list = 1; + if (delete) return delete_branches(argc, argv, delete > 1, kinds); - else if (argc == 0 || (verbose && argc == 1)) + else if (list) return print_ref_list(kinds, detached, verbose, abbrev, with_commit, argc ? argv[0] : NULL); else if (rename && (argc == 1)) rename_branch(head, argv[0], rename > 1); -- 1.7.5.270.gafca7 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html