Skip to content

Commit d8e7c67

Browse files
Perdugitster
authored andcommitted
git-remote-mediawiki: make error message more precise
In subroutine parse_command, error messages were not correct. For the "import" function, having too much or incorrect arguments displayed both "invalid arguments", while it displayed "too many arguments" for the "option" functions under the same conditions. Separate the two error messages in both cases. Signed-off-by: Célestin Matte <[email protected]> Signed-off-by: Matthieu Moy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e3e7d34 commit d8e7c67

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

contrib/mw-to-git/git-remote-mediawiki.perl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,16 @@ sub parse_command {
161161
die("Too many arguments for list\n") if (defined($cmd[2]));
162162
mw_list($cmd[1]);
163163
} elsif ($cmd[0] eq 'import') {
164-
die("Invalid arguments for import\n")
165-
if ($cmd[1] eq EMPTY || defined($cmd[2]));
164+
die("Invalid argument for import\n")
165+
if ($cmd[1] eq EMPTY);
166+
die("Too many arguments for import\n")
167+
if (defined($cmd[2]));
166168
mw_import($cmd[1]);
167169
} elsif ($cmd[0] eq 'option') {
170+
die("Invalid arguments for option\n")
171+
if ($cmd[1] eq EMPTY || $cmd[2] eq EMPTY);
168172
die("Too many arguments for option\n")
169-
if ($cmd[1] eq EMPTY || $cmd[2] eq EMPTY || defined($cmd[3]));
173+
if (defined($cmd[3]));
170174
mw_option($cmd[1],$cmd[2]);
171175
} elsif ($cmd[0] eq 'push') {
172176
mw_push($cmd[1]);

0 commit comments

Comments
 (0)