Junio C Hamano <gits...@pobox.com> writes:

> With these two patches queued on top of jk/branch-l-0-deprecation,
> the follow-up patches jk/branch-l-1-removal that makes 'branch -l'
> to fail and then jk/branch-l-2-reincarnation that makes 'branch -l'
> a synonym to 'branch --list' needs rebasing.  Both are trivial and
> hopefully I did them correctly.
>
> -- >8 --
> From: Jeff King <p...@peff.net>
> Date: Mon, 26 Mar 2018 03:29:22 -0400
> Subject: [PATCH] branch: drop deprecated "-l" option

And this is the final "reincarnation" step.

-- >8 --
From: Jeff King <p...@peff.net>
Date: Mon, 26 Mar 2018 03:29:48 -0400
Subject: [PATCH] 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 sufficient time has
passed with that alias removed, we can finally repurpose it.

Signed-off-by: Jeff King <p...@peff.net>
Reviewed-by: Eric Sunshine <sunsh...@sunshineco.com>
Reviewed-by: Jacob Keller <jacob.kel...@gmail.com>
[jc: adjusted the new tests added earlier]
Signed-off-by: Junio C Hamano <gits...@pobox.com>
---
 builtin/branch.c  | 2 +-
 t/t3200-branch.sh | 8 +-------
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/builtin/branch.c b/builtin/branch.c
index 01b35b3c3d..1d06f5c547 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -612,7 +612,7 @@ 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")),
                OPT_BOOL(0, "edit-description", &edit_description,
                         N_("edit the description for the branch")),
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index eca75d3ca1..022d6a41c8 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -45,12 +45,6 @@ test_expect_success 'git branch HEAD should fail' '
        test_must_fail git branch HEAD
 '
 
-test_expect_success 'git branch -l no longer is --create-reflog' '
-       test_when_finished "git branch -D new-branch-with-reflog || :" &&
-       test_must_fail git branch -l new-branch-with-reflog &&
-       test_must_fail git rev-parse --verify refs/heads/new-branch-with-reflog
-'
-
 cat >expect <<EOF
 $_z40 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000        
branch: Created from master
 EOF
@@ -294,7 +288,7 @@ test_expect_success 'git branch --list -v with --abbrev' '
 
 '
 
-test_expect_failure 'git branch -l eventually is --list' '
+test_expect_success 'git branch -l is --list' '
        git branch --list >expect &&
        git branch -l >actual &&
        test_cmp expect actual
-- 
2.17.0-775-ge144d126d7

Reply via email to