{"thread":{"id":"36481","subject":"[PATCH 1/2] git-remote-mediawiki: allow stop/start-ing the test server","startedAt":"2014-04-23T14:34:28Z","lastAt":"2014-04-23T14:34:29Z","messageCount":2,"participants":["Matthieu Moy"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"239440","messageId":"1398263669-16594-1-git-send-email-Matthieu.Moy@imag.fr","threadId":"36481","inReplyTo":null,"subject":"[PATCH 1/2] git-remote-mediawiki: allow stop/start-ing the test server","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2014-04-23T14:34:28Z","receivedAt":"2014-04-23T14:34:28Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Previously, the user had to launch a complete re-install after a lighttpd\nstop (e.g. a reboot).\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n contrib/mw-to-git/t/install-wiki.sh   | 10 ++++++++++\n contrib/mw-to-git/t/test-gitmw-lib.sh |  2 +-\n 2 files changed, 11 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/mw-to-git/t/install-wiki.sh b/contrib/mw-to-git/t/install-wiki.sh\nindex 70a53f6..c215213 100755\n--- a/contrib/mw-to-git/t/install-wiki.sh\n+++ b/contrib/mw-to-git/t/install-wiki.sh\n@@ -20,6 +20,8 @@ usage () {\n \techo \"\t\tinstall | -i :\tInstall a wiki on your computer.\"\n \techo \"\t\tdelete | -d : Delete the wiki and all its pages and \"\n \techo \"\t\t\tcontent.\"\n+\techo \"\t\tstart  | -s : Start the previously configured lighttpd daemon\"\n+\techo \"\t\tstop        : Stop lighttpd daemon.\"\n }\n \n \n@@ -33,6 +35,14 @@ case \"$1\" in\n \t\twiki_delete\n \t\texit 0\n \t\t;;\n+\t\"start\" | \"-s\")\n+\t\tstart_lighttpd\n+\t\texit\n+\t\t;;\n+\t\"stop\")\n+\t\tstop_lighttpd\n+\t\texit\n+\t\t;;\n \t\"--help\" | \"-h\")\n \t\tusage\n \t\texit 0\ndiff --git a/contrib/mw-to-git/t/test-gitmw-lib.sh b/contrib/mw-to-git/t/test-gitmw-lib.sh\nindex 3372b2a..d9a1149 100755\n--- a/contrib/mw-to-git/t/test-gitmw-lib.sh\n+++ b/contrib/mw-to-git/t/test-gitmw-lib.sh\n@@ -289,7 +289,6 @@ start_lighttpd () {\n # Kill daemon lighttpd and removes files and folders associated.\n stop_lighttpd () {\n \ttest -f \"$WEB_TMP/pid\" && kill $(cat \"$WEB_TMP/pid\")\n-\trm -rf \"$WEB\"\n }\n \n # Create the SQLite database of the MediaWiki. If the database file already\n@@ -415,6 +414,7 @@ wiki_reset () {\n wiki_delete () {\n \tif test $LIGHTTPD = \"true\"; then\n \t\tstop_lighttpd\n+\t\trm -fr \"$WEB\"\n \telse\n \t\t# Delete the wiki's directory.\n \t\trm -rf \"$WIKI_DIR_INST/$WIKI_DIR_NAME\" ||\n-- \n1.9.2.667.ge5b74e1\n"},{"id":"239443","messageId":"1398263669-16594-2-git-send-email-Matthieu.Moy@imag.fr","threadId":"36481","inReplyTo":"1398263669-16594-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH 2/2] git-remote-mediawiki: fix encoding issue for UTF-8 media files","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2014-04-23T14:34:29Z","receivedAt":"2014-04-23T14:34:29Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"When a media file contains valid UTF-8, git-remote-mediawiki tried to be\ntoo clever about the encoding, and the call to utf8::downgrade() on the\ndownloaded content was failing with\n\n  Wide character in subroutine entry at git-remote-mediawiki line 583.\n\nInstead, use $response->decode() to apply decoding linked to the\nContent-Encoding: header, and return the content without attempting any\ncharset decoding.\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl          |  7 ++++++-\n contrib/mw-to-git/t/t9363-mw-to-git-export-import.sh | 19 +++++++++++++++++++\n 2 files changed, 25 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex 3f8d993..8dd74a9 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -461,7 +461,12 @@ sub download_mw_mediafile {\n \n \tmy $response = $mediawiki->{ua}->get($download_url);\n \tif ($response->code == HTTP_CODE_OK) {\n-\t\treturn $response->decoded_content;\n+\t\t# It is tempting to return\n+\t\t# $response->decoded_content({charset => \"none\"}), but\n+\t\t# when doing so, utf8::downgrade($content) fails with\n+\t\t# \"Wide character in subroutine entry\".\n+\t\t$response->decode();\n+\t\treturn $response->content();\n \t} else {\n \t\tprint {*STDERR} \"Error downloading mediafile from :\\n\";\n \t\tprint {*STDERR} \"URL: ${download_url}\\n\";\ndiff --git a/contrib/mw-to-git/t/t9363-mw-to-git-export-import.sh b/contrib/mw-to-git/t/t9363-mw-to-git-export-import.sh\nindex 5a03739..3ff3a09 100755\n--- a/contrib/mw-to-git/t/t9363-mw-to-git-export-import.sh\n+++ b/contrib/mw-to-git/t/t9363-mw-to-git-export-import.sh\n@@ -58,6 +58,25 @@ test_expect_success 'git clone works on previously created wiki with media files\n \ttest_cmp mw_dir_clone/Foo.txt mw_dir/Foo.txt\n '\n \n+test_expect_success 'git push can upload media (File:) files containing valid UTF-8' '\n+\twiki_reset &&\n+\tgit clone mediawiki::'\"$WIKI_URL\"' mw_dir &&\n+\t(\n+\t\tcd mw_dir &&\n+\t\t\"$PERL_PATH\" -e \"print STDOUT \\\"UTF-8 content: éèàéê€.\\\";\" >Bar.txt &&\n+\t\tgit add Bar.txt &&\n+\t\tgit commit -m \"add a text file with UTF-8 content\" &&\n+\t\tgit push\n+\t)\n+'\n+\n+test_expect_success 'git clone works on previously created wiki with media files containing valid UTF-8' '\n+\ttest_when_finished \"rm -rf mw_dir mw_dir_clone\" &&\n+\tgit clone -c remote.origin.mediaimport=true \\\n+\t\tmediawiki::'\"$WIKI_URL\"' mw_dir_clone &&\n+\ttest_cmp mw_dir_clone/Bar.txt mw_dir/Bar.txt\n+'\n+\n test_expect_success 'git push & pull work with locally renamed media files' '\n \twiki_reset &&\n \tgit clone mediawiki::'\"$WIKI_URL\"' mw_dir &&\n-- \n1.9.2.667.ge5b74e1\n"}]}