git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/8] git-remote-mediawiki: actually send empty comment when they're empty

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 16, 2012, 18:13 UTC
Message-ID
<7vd33v377x.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1342440053-3058-3-git-send-email-Matthieu.Moy@imag.fr>
Matthieu Moy <Matthieu.Moy@imag.fr> writes:
Show 16 quoted lines
> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
> ---
>  contrib/mw-to-git/git-remote-mediawiki | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/contrib/mw-to-git/git-remote-mediawiki b/contrib/mw-to-git/git-remote-mediawiki
> index a6ad8cf..a2da52f 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*';
> +

Is there a reason why this sentinel value cannot be a real empty string?

Not that I am complaining, as I find it highly unlikely for a message stored in mw to be exactly "*Empty MediaWiki Message*", but just wondering.

Show 23 quoted lines
>  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);
Previous: Matthieu MoyNext: Matthieu Moy
Message 5 of 33 in “git-remote-mediawiki: fixes, optimizations, and progress report”
  1. 0/8 git-remote-mediawiki: fixes, optimizations, and progress reportMatthieu Moy, Jul 16, 2012
  2. 1/8 git-remote-mediawiki: don't split namespaces with spacesMatthieu Moy, Jul 16, 2012
  3. Junio C HamanoJul 16, 2012
  4. 2/8 git-remote-mediawiki: actually send empty comment when they're emptyMatthieu Moy, Jul 16, 2012
  5. Junio C HamanoJul 16, 2012
  6. Matthieu MoyJul 16, 2012
  7. Junio C HamanoJul 16, 2012
  8. 3/8 git-remote-mediawiki: make mediafiles export optionalMatthieu Moy, Jul 16, 2012
  9. Junio C HamanoJul 16, 2012
  10. Matthieu MoyJul 16, 2012
  11. 4/8 git-remote-mediawiki: get rid of O(N^2) loopMatthieu Moy, Jul 16, 2012
  12. Junio C HamanoJul 16, 2012
  13. Matthieu MoyJul 16, 2012
  14. 5/8 git-remote-mediawiki: use --force when adding notesMatthieu Moy, Jul 16, 2012
  15. 6/8 git-remote-mediawiki: show progress information when listing pagesMatthieu Moy, Jul 16, 2012
  16. 7/8 git-remote-mediawiki: show progress information when getting last remote revisionMatthieu Moy, Jul 16, 2012
  17. 8/8 git-remote-mediawiki: properly deal with invalid remote revisionsMatthieu Moy, Jul 16, 2012
  18. Junio C HamanoJul 16, 2012
  19. 0/8 git-remote-mediawiki: fixes, optimizations, and progress reportMatthieu Moy, Jul 16, 2012
  20. 1/8 git-remote-mediawiki: don't split namespaces with spacesMatthieu Moy, Jul 16, 2012
  21. 2/8 git-remote-mediawiki: actually send empty comment when they're emptyMatthieu Moy, Jul 16, 2012
  22. 3/8 git-remote-mediawiki: make mediafiles export optionalMatthieu Moy, Jul 16, 2012
  23. 4/8 git-remote-mediawiki: get rid of O(N^2) loopMatthieu Moy, Jul 16, 2012
  24. 5/8 git-remote-mediawiki: use --force when adding notesMatthieu Moy, Jul 16, 2012
  25. 6/8 git-remote-mediawiki: show progress information when listing pagesMatthieu Moy, Jul 16, 2012
  26. 7/8 git-remote-mediawiki: show progress information when getting last remote revisionMatthieu Moy, Jul 16, 2012
  27. 8/8 git-remote-mediawiki: properly deal with invalid remote revisionsMatthieu Moy, Jul 16, 2012
  28. Junio C HamanoJul 16, 2012
  29. 0/2 git-remote-mediawiki: two more fixesMatthieu Moy, Jul 17, 2012
  30. 1/2 git-remote-mediawiki: fix incorrect test usage in testMatthieu Moy, Jul 17, 2012
  31. 2/2 git-remote-mediawiki: allow page names with a ':'Matthieu Moy, Jul 17, 2012
  32. Dan JohnsonJul 20, 2012
  33. Matthieu MoyJul 23, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.