diff options
author | SZEDER Gábor <szeder.dev@gmail.com> | 2022-08-19 19:04:08 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-08-19 21:13:16 +0300 |
commit | b26a412f1e96e40c419001991486cced837679a6 (patch) | |
tree | 23f58d32b34c70fc13792f3035e86f45b68649fe /t/t5505-remote.sh | |
parent | 729b97332b05564133e4039fbab9f694c25097a2 (diff) |
builtin/remote.c: let parse-options parse subcommands
'git remote' parses its subcommands with a long list of if-else if
statements. parse-options has just learned to parse subcommands, so
let's use that facility instead, with the benefits of shorter code,
handling unknown subcommands, and listing subcommands for Bash
completion. Make sure that the default operation mode doesn't accept
any arguments; and while at it remove the capitalization of the error
message and adjust the test checking it accordingly.
Note that 'git remote' has both 'remove' and 'rm' subcommands, and the
former is preferred [1], so hide the latter for completion.
Note also that the functions implementing each subcommand only accept
the 'argc' and '**argv' parameters, so add a (unused) '*prefix'
parameter to make them match the type expected by parse-options, and
thus avoid casting a bunch of function pointers.
[1] e17dba8fe1 (remote: prefer subcommand name 'remove' to 'rm',
2012-09-06)
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5505-remote.sh')
-rwxr-xr-x | t/t5505-remote.sh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh index a549a21ef6..9006196ac6 100755 --- a/t/t5505-remote.sh +++ b/t/t5505-remote.sh @@ -258,7 +258,7 @@ test_expect_success 'without subcommand accepts -v' ' 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 + grep "^error: unknown subcommand:" err ' cat >test/expect <<EOF |