(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"Test the Git Mediawiki remote helper: git push and git pull simple test cases">)} spids: [35] ) ] spids: [35] ) (C {(.)} {(./test-gitmw-lib.sh)}) (C {(.)} {($ VSub_Name "$TEST_DIRECTORY") (/test-lib.sh)}) (C {(test_check_precond)}) (FuncDef name: test_git_reimport body: (BraceGroup children: [ (AndOr children: [ (C {(git)} {(-c)} {(remote.origin.dumbPush) (Lit_Other "=") (true)} {(push)}) (C {(git)} {(-c)} {(remote.origin.mediaImport) (Lit_Other "=") (true)} {(pull)} {(--rebase)} ) ] op_id: Op_DAmp ) ] spids: [61] ) spids: [56 60] ) (C {(test_expect_success)} {(SQ <"setup config">)} { (SQ <"\n"> <"\tgit config --global remote.origin.mwLogin WikiAdmin &&\n"> <"\tgit config --global remote.origin.mwPassword AdminPass &&\n"> <"\ttest_might_fail git config --global --unset remote.origin.mediaImport\n"> ) } ) (C {(test_expect_success)} {(SQ <"git push can upload media (File:) files">)} {(SQ <"\n"> <"\twiki_reset &&\n"> <"\tgit clone mediawiki::">) (DQ ($ VSub_Name "$WIKI_URL")) (SQ <" mw_dir &&\n"> <"\t(\n"> <"\t\tcd mw_dir &&\n"> <"\t\techo \"hello world\" >Foo.txt &&\n"> <"\t\tgit add Foo.txt &&\n"> <"\t\tgit commit -m \"add a text file\" &&\n"> <"\t\tgit push &&\n"> < "\t\t\"$PERL_PATH\" -e \"print STDOUT \\\"binary content: \\\".chr(255);\" >Foo.txt &&\n" > <"\t\tgit add Foo.txt &&\n"> <"\t\tgit commit -m \"add a text file with binary content\" &&\n"> <"\t\tgit push\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"git clone works on previously created wiki with media files">)} { (SQ <"\n"> <"\ttest_when_finished \"rm -rf mw_dir mw_dir_clone\" &&\n"> <"\tgit clone -c remote.origin.mediaimport=true \\\n"> <"\t\tmediawiki::"> ) (DQ ($ VSub_Name "$WIKI_URL")) (SQ <" mw_dir_clone &&\n"> <"\ttest_cmp mw_dir_clone/Foo.txt mw_dir/Foo.txt &&\n"> <"\t(cd mw_dir_clone && git checkout HEAD^) &&\n"> <"\t(cd mw_dir && git checkout HEAD^) &&\n"> <"\ttest_cmp mw_dir_clone/Foo.txt mw_dir/Foo.txt\n"> ) } ) (C {(test_expect_success)} {(SQ <"git push can upload media (File:) files containing valid UTF-8">)} {(SQ <"\n"> <"\twiki_reset &&\n"> <"\tgit clone mediawiki::">) (DQ ($ VSub_Name "$WIKI_URL")) (SQ <" mw_dir &&\n"> <"\t(\n"> <"\t\tcd mw_dir &&\n"> < "\t\t\"$PERL_PATH\" -e \"print STDOUT \\\"UTF-8 content: \u00e9\u00e8\u00e0\u00e9\u00ea\u20ac.\\\";\" >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"> ) } ) (C {(test_expect_success)} {(SQ <"git clone works on previously created wiki with media files containing valid UTF-8">)} { (SQ <"\n"> <"\ttest_when_finished \"rm -rf mw_dir mw_dir_clone\" &&\n"> <"\tgit clone -c remote.origin.mediaimport=true \\\n"> <"\t\tmediawiki::"> ) (DQ ($ VSub_Name "$WIKI_URL")) (SQ <" mw_dir_clone &&\n"> <"\ttest_cmp mw_dir_clone/Bar.txt mw_dir/Bar.txt\n">) } ) (C {(test_expect_success)} {(SQ <"git push & pull work with locally renamed media files">)} {(SQ <"\n"> <"\twiki_reset &&\n"> <"\tgit clone mediawiki::">) (DQ ($ VSub_Name "$WIKI_URL")) (SQ <" mw_dir &&\n"> <"\ttest_when_finished \"rm -fr mw_dir\" &&\n"> <"\t(\n"> <"\t\tcd mw_dir &&\n"> <"\t\techo \"A File\" >Foo.txt &&\n"> <"\t\tgit add Foo.txt &&\n"> <"\t\tgit commit -m \"add a file\" &&\n"> <"\t\tgit mv Foo.txt Bar.txt &&\n"> <"\t\tgit commit -m \"Rename a file\" &&\n"> <"\t\ttest_git_reimport &&\n"> <"\t\techo \"A File\" >expect &&\n"> <"\t\ttest_cmp expect Bar.txt &&\n"> <"\t\ttest_path_is_missing Foo.txt\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"git push can propagate local page deletion">)} {(SQ <"\n"> <"\twiki_reset &&\n"> <"\tgit clone mediawiki::">) (DQ ($ VSub_Name "$WIKI_URL")) (SQ <" mw_dir &&\n"> <"\ttest_when_finished \"rm -fr mw_dir\" &&\n"> <"\t(\n"> <"\t\tcd mw_dir &&\n"> <"\t\ttest_path_is_missing Foo.mw &&\n"> <"\t\techo \"hello world\" >Foo.mw &&\n"> <"\t\tgit add Foo.mw &&\n"> <"\t\tgit commit -m \"Add the page Foo\" &&\n"> <"\t\tgit push &&\n"> <"\t\trm -f Foo.mw &&\n"> <"\t\tgit commit -am \"Delete the page Foo\" &&\n"> <"\t\ttest_git_reimport &&\n"> <"\t\ttest_path_is_missing Foo.mw\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"git push can propagate local media file deletion">)} {(SQ <"\n"> <"\twiki_reset &&\n"> <"\tgit clone mediawiki::">) (DQ ($ VSub_Name "$WIKI_URL")) (SQ <" mw_dir &&\n"> <"\ttest_when_finished \"rm -fr mw_dir\" &&\n"> <"\t(\n"> <"\t\tcd mw_dir &&\n"> <"\t\techo \"hello world\" >Foo.txt &&\n"> <"\t\tgit add Foo.txt &&\n"> <"\t\tgit commit -m \"Add the text file Foo\" &&\n"> <"\t\tgit rm Foo.txt &&\n"> <"\t\tgit commit -m \"Delete the file Foo\" &&\n"> <"\t\ttest_git_reimport &&\n"> <"\t\ttest_path_is_missing Foo.txt\n"> <"\t)\n"> ) } ) (C {(test_expect_failure)} {(SQ <"git pull correctly imports media file deletion when no page link to it">)} {(SQ <"\n"> <"\twiki_reset &&\n"> <"\tgit clone mediawiki::">) (DQ ($ VSub_Name "$WIKI_URL")) (SQ <" mw_dir &&\n"> <"\ttest_when_finished \"rm -fr mw_dir\" &&\n"> <"\t(\n"> <"\t\tcd mw_dir &&\n"> <"\t\techo \"hello world\" >Foo.txt &&\n"> <"\t\tgit add Foo.txt &&\n"> <"\t\tgit commit -m \"Add the text file Foo\" &&\n"> <"\t\tgit push &&\n"> <"\t\tgit rm Foo.txt &&\n"> <"\t\tgit commit -m \"Delete the file Foo\" &&\n"> <"\t\ttest_git_reimport &&\n"> <"\t\ttest_path_is_missing Foo.txt\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"git push properly warns about insufficient permissions">)} {(SQ <"\n"> <"\twiki_reset &&\n"> <"\tgit clone mediawiki::">) (DQ ($ VSub_Name "$WIKI_URL")) (SQ <" mw_dir &&\n"> <"\ttest_when_finished \"rm -fr mw_dir\" &&\n"> <"\t(\n"> <"\t\tcd mw_dir &&\n"> <"\t\techo \"A File\" >foo.forbidden &&\n"> <"\t\tgit add foo.forbidden &&\n"> <"\t\tgit commit -m \"add a file\" &&\n"> <"\t\tgit push 2>actual &&\n"> <"\t\ttest_i18ngrep \"foo.forbidden is not a permitted file\" actual\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"setup a repository with media files">)} { (SQ <"\n"> <"\twiki_reset &&\n"> <"\twiki_editpage testpage \"I am linking a file [[File:File.txt]]\" false &&\n"> <"\techo \"File content\" >File.txt &&\n"> <"\twiki_upload_file File.txt &&\n"> <"\techo \"Another file content\" >AnotherFile.txt &&\n"> <"\twiki_upload_file AnotherFile.txt\n"> ) } ) (C {(test_expect_success)} {(SQ <"git clone works with one specific page cloned and mediaimport=true">)} { (SQ <"\n"> <"\tgit clone -c remote.origin.pages=testpage \\\n"> <"\t\t -c remote.origin.mediaimport=true \\\n"> <"\t\t\tmediawiki::"> ) (DQ ($ VSub_Name "$WIKI_URL")) (SQ <" mw_dir_15 &&\n"> <"\ttest_when_finished \"rm -rf mw_dir_15\" &&\n"> <"\ttest_contains_N_files mw_dir_15 3 &&\n"> <"\ttest_path_is_file mw_dir_15/Testpage.mw &&\n"> <"\ttest_path_is_file mw_dir_15/File:File.txt.mw &&\n"> <"\ttest_path_is_file mw_dir_15/File.txt &&\n"> <"\ttest_path_is_missing mw_dir_15/Main_Page.mw &&\n"> <"\ttest_path_is_missing mw_dir_15/File:AnotherFile.txt.mw &&\n"> <"\ttest_path_is_missing mw_dir_15/AnothetFile.txt &&\n"> <"\twiki_check_content mw_dir_15/Testpage.mw Testpage &&\n"> <"\ttest_cmp mw_dir_15/File.txt File.txt\n"> ) } ) (C {(test_expect_success)} {(SQ <"git clone works with one specific page cloned and mediaimport=false">)} { (SQ <"\n"> <"\ttest_when_finished \"rm -rf mw_dir_16\" &&\n"> <"\tgit clone -c remote.origin.pages=testpage \\\n"> <"\t\t\tmediawiki::"> ) (DQ ($ VSub_Name "$WIKI_URL")) (SQ <" mw_dir_16 &&\n"> <"\ttest_contains_N_files mw_dir_16 1 &&\n"> <"\ttest_path_is_file mw_dir_16/Testpage.mw &&\n"> <"\ttest_path_is_missing mw_dir_16/File:File.txt.mw &&\n"> <"\ttest_path_is_missing mw_dir_16/File.txt &&\n"> <"\ttest_path_is_missing mw_dir_16/Main_Page.mw &&\n"> <"\twiki_check_content mw_dir_16/Testpage.mw Testpage\n"> ) } ) (C {(test_expect_success)} {(SQ <"git clone works with one specific page cloned and mediaimport unset">)} { (SQ <"\n"> <"\ttest_when_finished \"rm -fr mw_dir_17\" &&\n"> <"\tgit clone -c remote.origin.pages=testpage \\\n"> <"\t\tmediawiki::"> ) (DQ ($ VSub_Name "$WIKI_URL")) (SQ <" mw_dir_17 &&\n"> <"\ttest_contains_N_files mw_dir_17 1 &&\n"> <"\ttest_path_is_file mw_dir_17/Testpage.mw &&\n"> <"\ttest_path_is_missing mw_dir_17/File:File.txt.mw &&\n"> <"\ttest_path_is_missing mw_dir_17/File.txt &&\n"> <"\ttest_path_is_missing mw_dir_17/Main_Page.mw &&\n"> <"\twiki_check_content mw_dir_17/Testpage.mw Testpage\n"> ) } ) (C {(test_done)}) ] )