Skip to content

Commit 31a66c1

Browse files
szedergitster
authored andcommitted
t5505-remote.sh: check the behavior without a subcommand
'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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9e4658d commit 31a66c1

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

t/t5505-remote.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,26 @@ test_expect_success 'add invalid foreign_vcs remote' '
241241
test_cmp expect actual
242242
'
243243

244+
test_expect_success 'without subcommand' '
245+
echo origin >expect &&
246+
git -C test remote >actual &&
247+
test_cmp expect actual
248+
'
249+
250+
test_expect_success 'without subcommand accepts -v' '
251+
cat >expect <<-EOF &&
252+
origin $(pwd)/one (fetch)
253+
origin $(pwd)/one (push)
254+
EOF
255+
git -C test remote -v >actual &&
256+
test_cmp expect actual
257+
'
258+
259+
test_expect_success 'without subcommand does not take arguments' '
260+
test_expect_code 129 git -C test remote origin 2>err &&
261+
grep "^error: Unknown subcommand:" err
262+
'
263+
244264
cat >test/expect <<EOF
245265
* remote origin
246266
Fetch URL: $(pwd)/one

0 commit comments

Comments
 (0)