diff options
| author | Junio C Hamano <gitster@pobox.com> | 2023-07-18 11:27:49 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-07-18 12:19:53 -0700 |
| commit | e12cb98e1e083c23a03fcfabb3a3c6a5a22ce3c5 (patch) | |
| tree | b64357d7ccd2c6d91dc709a74795898e9e82b086 /t/t3203-branch-output.sh | |
| parent | fb7d80edcae482f4fa5d4be0227dc3054734e5f3 (diff) | |
| download | git-e12cb98e1e083c23a03fcfabb3a3c6a5a22ce3c5.tar.gz | |
branch: reject "--no-all" and "--no-remotes" early
As the command line parser for "git branch --all" forgets to use
PARSE_OPT_NONEG, it accepted "git branch --no-all", and then passed
a nonsense value to the underlying machinery, leading to a fatal
error "filter_refs: invalid type". The "--remotes" option had
exactly the same issue.
Catch the unsupported options early in the option parser.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3203-branch-output.sh')
| -rwxr-xr-x | t/t3203-branch-output.sh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh index 93f8295339..758963b189 100755 --- a/t/t3203-branch-output.sh +++ b/t/t3203-branch-output.sh @@ -55,9 +55,17 @@ cat >expect <<'EOF' EOF test_expect_success 'git branch -r shows remote branches' ' git branch -r >actual && + test_cmp expect actual && + + git branch --remotes >actual && test_cmp expect actual ' +test_expect_success 'git branch --no-remotes is rejected' ' + test_must_fail git branch --no-remotes 2>err && + grep "unknown option .no-remotes." err +' + cat >expect <<'EOF' branch-one branch-two @@ -68,9 +76,17 @@ cat >expect <<'EOF' EOF test_expect_success 'git branch -a shows local and remote branches' ' git branch -a >actual && + test_cmp expect actual && + + git branch --all >actual && test_cmp expect actual ' +test_expect_success 'git branch --no-all is rejected' ' + test_must_fail git branch --no-all 2>err && + grep "unknown option .no-all." err +' + cat >expect <<'EOF' two one |
