summaryrefslogtreecommitdiff
path: root/contrib/mw-to-git/git-remote-mediawiki.perl
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-06-20 23:02:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-06-20 23:02:42 (GMT)
commit0c36f3a198fab35c694a1e38c57227989c98e48e (patch)
tree5109a9df3842d9e2629c0b75b91d335d6a88731b /contrib/mw-to-git/git-remote-mediawiki.perl
parent50f69099292de53431ef29d3adc115d04a4fd92a (diff)
parent5ada8687995fadea01f755d52ceec58337d003a3 (diff)
downloadgit-0c36f3a198fab35c694a1e38c57227989c98e48e.zip
git-0c36f3a198fab35c694a1e38c57227989c98e48e.tar.gz
git-0c36f3a198fab35c694a1e38c57227989c98e48e.tar.bz2
Merge branch 'cm/remote-mediawiki'
* cm/remote-mediawiki: git-remote-mediawiki: display message when launched directly
Diffstat (limited to 'contrib/mw-to-git/git-remote-mediawiki.perl')
-rwxr-xr-xcontrib/mw-to-git/git-remote-mediawiki.perl15
1 files changed, 15 insertions, 0 deletions
diff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl
index 7173872..c1a967b 100755
--- a/contrib/mw-to-git/git-remote-mediawiki.perl
+++ b/contrib/mw-to-git/git-remote-mediawiki.perl
@@ -42,6 +42,10 @@ use constant NULL_SHA1 => "0000000000000000000000000000000000000000";
# Used on Git's side to reflect empty edit messages on the wiki
use constant EMPTY_MESSAGE => '*Empty MediaWiki Message*';
+if (@ARGV != 2) {
+ exit_error_usage();
+}
+
my $remotename = $ARGV[0];
my $url = $ARGV[1];
@@ -157,6 +161,17 @@ while (<STDIN>) {
########################## Functions ##############################
+## error handling
+sub exit_error_usage {
+ die "ERROR: git-remote-mediawiki module was not called with a correct number of\n" .
+ "parameters\n" .
+ "You may obtain this error because you attempted to run the git-remote-mediawiki\n" .
+ "module directly.\n" .
+ "This module can be used the following way:\n" .
+ "\tgit clone mediawiki://<address of a mediawiki>\n" .
+ "Then, use git commit, push and pull as with every normal git repository.\n";
+}
+
# MediaWiki API instance, created lazily.
my $mediawiki;