branch: make "-l" a synonym for "--list"
authorJeff King <peff@peff.net>
Fri, 22 Jun 2018 09:24:59 +0000 (05:24 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 22 Jun 2018 20:20:51 +0000 (13:20 -0700)
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>
Documentation/git-branch.txt
builtin/branch.c
index 1072ca0eb61e45f5049fedfd24a7512ff81ee957..fc88e984e1704a43d11e9af49fd028f72bc7eed6 100644 (file)
@@ -100,8 +100,6 @@ OPTIONS
        The negated form `--no-create-reflog` only overrides an earlier
        `--create-reflog`, but currently does not negate the setting of
        `core.logAllRefUpdates`.
-+
-The `-l` option is a deprecated synonym for `--create-reflog`.
 
 -f::
 --force::
@@ -156,6 +154,7 @@ This option is only applicable in non-verbose mode.
 --all::
        List both remote-tracking branches and local branches.
 
+-l::
 --list::
        List branches.  With optional `<pattern>...`, e.g. `git
        branch --list 'maint-*'`, list only the branches that match
index ed4c093747d54bbb734ed3d2c3b7895283deb748..c1662e3db34cca697ceb85239b4a93ce0f36ce05 100644 (file)
@@ -36,7 +36,6 @@ static const char * const builtin_branch_usage[] = {
 
 static const char *head;
 static struct object_id head_oid;
-static int used_deprecated_reflog_option;
 
 static int branch_use_color = -1;
 static char branch_colors[][COLOR_MAXLEN] = {
@@ -574,14 +573,6 @@ static int edit_branch_description(const char *branch_name)
        return 0;
 }
 
-static int deprecated_reflog_option_cb(const struct option *opt,
-                                      const char *arg, int unset)
-{
-       used_deprecated_reflog_option = 1;
-       *(int *)opt->value = !unset;
-       return 0;
-}
-
 int cmd_branch(int argc, const char **argv, const char *prefix)
 {
        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)
                OPT_BIT('M', NULL, &rename, N_("move/rename a branch, even if target exists"), 2),
                OPT_BIT('c', "copy", &copy, N_("copy a branch and its reflog"), 1),
                OPT_BIT('C', NULL, &copy, N_("copy a branch, even if target exists"), 2),
-               OPT_BOOL(0, "list", &list, N_("list branch names")),
+               OPT_BOOL('l', "list", &list, N_("list branch names")),
                OPT_BOOL(0, "create-reflog", &reflog, N_("create the branch's reflog")),
-               {
-                       OPTION_CALLBACK, 'l', NULL, &reflog, NULL,
-                       N_("deprecated synonym for --create-reflog"),
-                       PARSE_OPT_NOARG | PARSE_OPT_HIDDEN,
-                       deprecated_reflog_option_cb
-               },
                OPT_BOOL(0, "edit-description", &edit_description,
                         N_("edit the description for the branch")),
                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)
        if (list)
                setup_auto_pager("branch", 1);
 
-       if (used_deprecated_reflog_option && !list) {
-               warning("the '-l' alias for '--create-reflog' is deprecated;");
-               warning("it will be removed in a future version of Git");
-       }
-
        if (delete) {
                if (!argc)
                        die(_("branch name required"));