Skip to content

Commit

Permalink
git-remote-mediawiki: make error message more precise
Browse files Browse the repository at this point in the history
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 <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Célestin Matte authored and Junio C Hamano committed Jun 14, 2013
1 parent e3e7d34 commit d8e7c67
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions contrib/mw-to-git/git-remote-mediawiki.perl
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,16 @@ sub parse_command {
die("Too many arguments for list\n") if (defined($cmd[2]));
mw_list($cmd[1]);
} elsif ($cmd[0] eq 'import') {
die("Invalid arguments for import\n")
if ($cmd[1] eq EMPTY || defined($cmd[2]));
die("Invalid argument for import\n")
if ($cmd[1] eq EMPTY);
die("Too many arguments for import\n")
if (defined($cmd[2]));
mw_import($cmd[1]);
} elsif ($cmd[0] eq 'option') {
die("Invalid arguments for option\n")
if ($cmd[1] eq EMPTY || $cmd[2] eq EMPTY);
die("Too many arguments for option\n")
if ($cmd[1] eq EMPTY || $cmd[2] eq EMPTY || defined($cmd[3]));
if (defined($cmd[3]));
mw_option($cmd[1],$cmd[2]);
} elsif ($cmd[0] eq 'push') {
mw_push($cmd[1]);
Expand Down

0 comments on commit d8e7c67

Please sign in to comment.