aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Moy <Matthieu.Moy@imag.fr>2012-07-16 14:00:47 +0200
committerJunio C Hamano <gitster@pobox.com>2012-07-16 11:06:14 -0700
commitdcb1ea620d1e8bd1d7e7622b7ca69050d0c119d7 (patch)
tree13d91a5b789a1e409c13d4da75ee9a54bd87a881
parentac4bbb41b25949adff3afa96b2821f648abad8b3 (diff)
downloadgit-dcb1ea620d1e8bd1d7e7622b7ca69050d0c119d7.tar.gz
git-dcb1ea620d1e8bd1d7e7622b7ca69050d0c119d7.tar.xz
git-remote-mediawiki: actually send empty comment when they're empty
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xcontrib/mw-to-git/git-remote-mediawiki9
1 files changed, 8 insertions, 1 deletions
diff --git a/contrib/mw-to-git/git-remote-mediawiki b/contrib/mw-to-git/git-remote-mediawiki
index a6ad8cf33..a2da52f4d 100755
--- a/contrib/mw-to-git/git-remote-mediawiki
+++ b/contrib/mw-to-git/git-remote-mediawiki
@@ -51,6 +51,9 @@ use constant EMPTY_CONTENT => "<!-- empty page -->\n";
# used to reflect file creation or deletion in diff.
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*';
+
my $remotename = $ARGV[0];
my $url = $ARGV[1];
@@ -935,7 +938,7 @@ sub mw_import_revids {
my %commit;
$commit{author} = $rev->{user} || 'Anonymous';
- $commit{comment} = $rev->{comment} || '*Empty MediaWiki Message*';
+ $commit{comment} = $rev->{comment} || EMPTY_MESSAGE;
$commit{title} = mediawiki_smudge_filename($page_title);
$commit{mw_revision} = $rev->{revid};
$commit{content} = mediawiki_smudge($rev->{'*'});
@@ -1050,6 +1053,10 @@ sub mw_push_file {
my $oldrevid = shift;
my $newrevid;
+ if ($summary eq EMPTY_MESSAGE) {
+ $summary = '';
+ }
+
my $new_sha1 = $diff_info_split[3];
my $old_sha1 = $diff_info_split[2];
my $page_created = ($old_sha1 eq NULL_SHA1);