Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-07-18 21:27:49 +0300
committerJunio C Hamano <gitster@pobox.com>2023-07-18 22:19:53 +0300
commite12cb98e1e083c23a03fcfabb3a3c6a5a22ce3c5 (patch)
treeb64357d7ccd2c6d91dc709a74795898e9e82b086 /t
parentfb7d80edcae482f4fa5d4be0227dc3054734e5f3 (diff)
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')
-rwxr-xr-xt/t3203-branch-output.sh16
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