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>

Matthieu Moy committed Jul 16, 2012 at 14:00 UTC dcb1ea620d1e8bd1d7e7622b7ca69050d0c119d7
1 file changed +8 -1
contrib/mw-to-git/git-remote-mediawiki
+8 -1
@@ -51,6 +51,9 @@ use constant EMPTY_CONTENT => "<!-- empty page -->\n";
51 # used to reflect file creation or deletion in diff.
52 use constant NULL_SHA1 => "0000000000000000000000000000000000000000";
53
54 +# Used on Git's side to reflect empty edit messages on the wiki
55 +use constant EMPTY_MESSAGE => '*Empty MediaWiki Message*';
56 +
57 my $remotename = $ARGV[0];
58 my $url = $ARGV[1];
59
@@ -935,7 +938,7 @@ sub mw_import_revids {
938
939 my %commit;
940 $commit{author} = $rev->{user} || 'Anonymous';
938 - $commit{comment} = $rev->{comment} || '*Empty MediaWiki Message*';
941 + $commit{comment} = $rev->{comment} || EMPTY_MESSAGE;
942 $commit{title} = mediawiki_smudge_filename($page_title);
943 $commit{mw_revision} = $rev->{revid};
944 $commit{content} = mediawiki_smudge($rev->{'*'});
@@ -1050,6 +1053,10 @@ sub mw_push_file {
1053 my $oldrevid = shift;
1054 my $newrevid;
1055
1056 + if ($summary eq EMPTY_MESSAGE) {
1057 + $summary = '';
1058 + }
1059 +
1060 my $new_sha1 = $diff_info_split[3];
1061 my $old_sha1 = $diff_info_split[2];
1062 my $page_created = ($old_sha1 eq NULL_SHA1);