branch: make "-l" a synonym for "--list"

The other "mode" options of git-branch have short-option aliases that are easy to type (e.g., "-d" and "-m"). Let's give "--list" the same treatment. This also makes it consistent with the similar "git tag -l" option. We didn't do this originally because "--create-reflog" was squatting on the "-l" option. Now that we've deprecated that use for long enough, we can make the switch. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Jun 22, 2018 at 05:24 UTC a15d598124813a71f0a221b4fcabeb75f40aebd7
2 files changed +2 -23
Documentation/git-branch.txt
+1 -2
@@ -100,8 +100,6 @@ OPTIONS
100 The negated form `--no-create-reflog` only overrides an earlier
101 `--create-reflog`, but currently does not negate the setting of
102 `core.logAllRefUpdates`.
103 -+
104 -The `-l` option is a deprecated synonym for `--create-reflog`.
103
104 -f::
105 --force::
@@ -156,6 +154,7 @@ This option is only applicable in non-verbose mode.
154 --all::
155 List both remote-tracking branches and local branches.
156
157 +-l::
158 --list::
159 List branches. With optional `<pattern>...`, e.g. `git
160 branch --list 'maint-*'`, list only the branches that match
builtin/branch.c
+1 -21
@@ -36,7 +36,6 @@ static const char * const builtin_branch_usage[] = {
36
37 static const char *head;
38 static struct object_id head_oid;
39 -static int used_deprecated_reflog_option;
39
40 static int branch_use_color = -1;
41 static char branch_colors[][COLOR_MAXLEN] = {
@@ -574,14 +573,6 @@ static int edit_branch_description(const char *branch_name)
573 return 0;
574 }
575
577 -static int deprecated_reflog_option_cb(const struct option *opt,
578 - const char *arg, int unset)
579 -{
580 - used_deprecated_reflog_option = 1;
581 - *(int *)opt->value = !unset;
582 - return 0;
583 -}
584 -
576 int cmd_branch(int argc, const char **argv, const char *prefix)
577 {
578 int delete = 0, rename = 0, copy = 0, force = 0, list = 0;
@@ -623,14 +614,8 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
614 OPT_BIT('M', NULL, &rename, N_("move/rename a branch, even if target exists"), 2),
615 OPT_BIT('c', "copy", &copy, N_("copy a branch and its reflog"), 1),
616 OPT_BIT('C', NULL, &copy, N_("copy a branch, even if target exists"), 2),
626 - OPT_BOOL(0, "list", &list, N_("list branch names")),
617 + OPT_BOOL('l', "list", &list, N_("list branch names")),
618 OPT_BOOL(0, "create-reflog", &reflog, N_("create the branch's reflog")),
628 - {
629 - OPTION_CALLBACK, 'l', NULL, &reflog, NULL,
630 - N_("deprecated synonym for --create-reflog"),
631 - PARSE_OPT_NOARG | PARSE_OPT_HIDDEN,
632 - deprecated_reflog_option_cb
633 - },
619 OPT_BOOL(0, "edit-description", &edit_description,
620 N_("edit the description for the branch")),
621 OPT__FORCE(&force, N_("force creation, move/rename, deletion"), PARSE_OPT_NOCOMPLETE),
@@ -703,11 +688,6 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
688 if (list)
689 setup_auto_pager("branch", 1);
690
706 - if (used_deprecated_reflog_option && !list) {
707 - warning("the '-l' alias for '--create-reflog' is deprecated;");
708 - warning("it will be removed in a future version of Git");
709 - }
710 -
691 if (delete) {
692 if (!argc)
693 die(_("branch name required"));