Skip to content

Commit 0c36f3a

Browse files
committed
Merge branch 'cm/remote-mediawiki'
* cm/remote-mediawiki: git-remote-mediawiki: display message when launched directly
2 parents 50f6909 + 5ada868 commit 0c36f3a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242
# Used on Git's side to reflect empty edit messages on the wiki
4343
use constant EMPTY_MESSAGE => '*Empty MediaWiki Message*';
4444

45+
if (@ARGV != 2) {
46+
exit_error_usage();
47+
}
48+
4549
my $remotename = $ARGV[0];
4650
my $url = $ARGV[1];
4751

@@ -157,6 +161,17 @@
157161

158162
########################## Functions ##############################
159163

164+
## error handling
165+
sub exit_error_usage {
166+
die "ERROR: git-remote-mediawiki module was not called with a correct number of\n" .
167+
"parameters\n" .
168+
"You may obtain this error because you attempted to run the git-remote-mediawiki\n" .
169+
"module directly.\n" .
170+
"This module can be used the following way:\n" .
171+
"\tgit clone mediawiki://<address of a mediawiki>\n" .
172+
"Then, use git commit, push and pull as with every normal git repository.\n";
173+
}
174+
160175
# MediaWiki API instance, created lazily.
161176
my $mediawiki;
162177

0 commit comments

Comments
 (0)