summaryrefslogtreecommitdiff
path: root/contrib/mw-to-git/t
diff options
context:
space:
mode:
authorLibravatar Matthieu Moy <Matthieu.Moy@imag.fr>2012-11-29 18:00:55 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2012-11-29 11:16:33 -0800
commit462d97daf69951f968f16b6271de9db34f7dd13c (patch)
tree16cfb3a488e4790889ccb856d5b5ca63a2b1ccbb /contrib/mw-to-git/t
parentStart preparing for 1.8.0.2 (diff)
downloadtgif-462d97daf69951f968f16b6271de9db34f7dd13c.tar.xz
git-remote-mediawiki: escape ", \, and LF in file names
A mediawiki page can contain, and even start with a " character, we have to escape it when generating the fast-export stream, as well as \ character. While we're there, also escape newlines, but I don't think we can get them from MediaWiki pages. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/mw-to-git/t')
-rwxr-xr-xcontrib/mw-to-git/t/t9362-mw-to-git-utf8.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/contrib/mw-to-git/t/t9362-mw-to-git-utf8.sh b/contrib/mw-to-git/t/t9362-mw-to-git-utf8.sh
index 246d47d8fb..b6405ce262 100755
--- a/contrib/mw-to-git/t/t9362-mw-to-git-utf8.sh
+++ b/contrib/mw-to-git/t/t9362-mw-to-git-utf8.sh
@@ -318,4 +318,30 @@ test_expect_success 'git push with \ in format control' '
'
+test_expect_success 'fast-import meta-characters in page name (mw -> git)' '
+ wiki_reset &&
+ wiki_editpage \"file\"_\\_foo "expect to be called \"file\"_\\_foo" false &&
+ git clone mediawiki::'"$WIKI_URL"' mw_dir_21 &&
+ test_path_is_file mw_dir_21/\"file\"_\\_foo.mw &&
+ wiki_getallpage ref_page_21 &&
+ test_diff_directories mw_dir_21 ref_page_21
+'
+
+
+test_expect_success 'fast-import meta-characters in page name (git -> mw) ' '
+ wiki_reset &&
+ git clone mediawiki::'"$WIKI_URL"' mw_dir_22 &&
+ (
+ cd mw_dir_22 &&
+ echo "this file is called \"file\"_\\_foo.mw" >\"file\"_\\_foo &&
+ git add . &&
+ git commit -am "file \"file\"_\\_foo" &&
+ git pull &&
+ git push
+ ) &&
+ wiki_getallpage ref_page_22 &&
+ test_diff_directories mw_dir_22 ref_page_22
+'
+
+
test_done