Skip to content

Commit

Permalink
t5505-remote.sh: check the behavior without a subcommand
Browse files Browse the repository at this point in the history
'git remote' without a subcommand defaults to listing all remotes and
doesn't accept any arguments except the '-v|--verbose' option.

We are about to teach parse-options to handle subcommands, and update
'git remote' to make use of that new feature.  So let's add some tests
to make sure that the upcoming changes don't inadvertently change the
behavior in these cases.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
szeder authored and gitster committed Aug 19, 2022
1 parent 9e4658d commit 31a66c1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions t/t5505-remote.sh
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,26 @@ test_expect_success 'add invalid foreign_vcs remote' '
test_cmp expect actual
'

test_expect_success 'without subcommand' '
echo origin >expect &&
git -C test remote >actual &&
test_cmp expect actual
'

test_expect_success 'without subcommand accepts -v' '
cat >expect <<-EOF &&
origin $(pwd)/one (fetch)
origin $(pwd)/one (push)
EOF
git -C test remote -v >actual &&
test_cmp expect actual
'

test_expect_success 'without subcommand does not take arguments' '
test_expect_code 129 git -C test remote origin 2>err &&
grep "^error: Unknown subcommand:" err
'

cat >test/expect <<EOF
* remote origin
Fetch URL: $(pwd)/one
Expand Down

0 comments on commit 31a66c1

Please sign in to comment.