Skip to content

Commit a15d598

Browse files
peffgitster
authored andcommitted
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>
1 parent 055930b commit a15d598

File tree

2 files changed

+2
-23
lines changed

2 files changed

+2
-23
lines changed

Documentation/git-branch.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ OPTIONS
100100
The negated form `--no-create-reflog` only overrides an earlier
101101
`--create-reflog`, but currently does not negate the setting of
102102
`core.logAllRefUpdates`.
103-
+
104-
The `-l` option is a deprecated synonym for `--create-reflog`.
105103

106104
-f::
107105
--force::
@@ -156,6 +154,7 @@ This option is only applicable in non-verbose mode.
156154
--all::
157155
List both remote-tracking branches and local branches.
158156

157+
-l::
159158
--list::
160159
List branches. With optional `<pattern>...`, e.g. `git
161160
branch --list 'maint-*'`, list only the branches that match

builtin/branch.c

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ static const char * const builtin_branch_usage[] = {
3636

3737
static const char *head;
3838
static struct object_id head_oid;
39-
static int used_deprecated_reflog_option;
4039

4140
static int branch_use_color = -1;
4241
static char branch_colors[][COLOR_MAXLEN] = {
@@ -574,14 +573,6 @@ static int edit_branch_description(const char *branch_name)
574573
return 0;
575574
}
576575

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-
585576
int cmd_branch(int argc, const char **argv, const char *prefix)
586577
{
587578
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)
623614
OPT_BIT('M', NULL, &rename, N_("move/rename a branch, even if target exists"), 2),
624615
OPT_BIT('c', "copy", &copy, N_("copy a branch and its reflog"), 1),
625616
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")),
627618
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-
},
634619
OPT_BOOL(0, "edit-description", &edit_description,
635620
N_("edit the description for the branch")),
636621
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)
703688
if (list)
704689
setup_auto_pager("branch", 1);
705690

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-
711691
if (delete) {
712692
if (!argc)
713693
die(_("branch name required"));

0 commit comments

Comments
 (0)