Re: [PATCHv2 4/5] branch: introduce --list option
- From
Michael J Gruber <git@drmicha.warpmail.net>
- Date
- Aug 28, 2011, 14:37 UTC
- Message-ID
- <4E5A5290.4050005@drmicha.warpmail.net>
- In-Reply-To
- <7vfwkodq5s.fsf@alter.siamese.dyndns.org>
Junio C Hamano venit, vidit, dixit 26.08.2011 19:43:
Show 50 quoted lines
> Michael J Gruber <git@drmicha.warpmail.net> writes: > >> Currently, there is no way to invoke the list mode explicitly. > > ..., without giving -v to force verbose output. > >> Introduce a --list option which invokes the list mode. This will be >> beneficial for invoking list mode with pattern matching, which otherwise >> would be interpreted as branch creation. >> >> Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> >> --- > >> @@ -20,7 +20,8 @@ DESCRIPTION >> >> With no arguments, existing branches are listed and the current branch will >> be highlighted with an asterisk. Option `-r` causes the remote-tracking >> -branches to be listed, and option `-a` shows both. >> +branches to be listed, and option `-a` shows both. This list mode is also >> +activated by the `--list` and `-v` options (see below). > > Very good to mention "and -v" here ;-) > >> diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh >> index 6b7c118..61e095c 100755 >> --- a/t/t3203-branch-output.sh >> +++ b/t/t3203-branch-output.sh >> @@ -32,6 +32,20 @@ test_expect_success 'git branch shows local branches' ' >> test_cmp expect actual >> ' >> >> +test_expect_success 'git branch --list shows local branches' ' >> + git branch --list >actual && >> + test_cmp expect actual >> +' >> + >> +cat >expect <<'EOF' >> + branch-one >> + branch-two >> +EOF >> +test_expect_success 'git branch --list pattern shows matching local branches' ' >> + git branch --list branch* >actual && >> + test_cmp expect actual >> +' >> + > > Could we have a test to check the code you updated to sanity check the > combination of options as well? I suspect the reason your initial round > botched the "branch -v -m foo" without realizing may be because we do not > cover the error checking.
Currently, "-m -d" is forbidden", but "-m -v" is "-m", same for "-d -v". Do we want to keep it like that? Probably. I'll add the tests to 4/5.
Michael