proc test_push_pull { test_expect_success 'Git pull works after adding a new wiki page' ' wiki_reset && git clone mediawiki::'"$WIKI_URL"' mw_dir_1 && wiki_editpage Foo "page created after the git clone" false && ( cd mw_dir_1 && git pull ) && wiki_getallpage ref_page_1 && test_diff_directories mw_dir_1 ref_page_1 ' test_expect_success 'Git pull works after editing a wiki page' ' wiki_reset && wiki_editpage Foo "page created before the git clone" false && git clone mediawiki::'"$WIKI_URL"' mw_dir_2 && wiki_editpage Foo "new line added on the wiki" true && ( cd mw_dir_2 && git pull ) && wiki_getallpage ref_page_2 && test_diff_directories mw_dir_2 ref_page_2 ' test_expect_success 'git pull works on conflict handled by auto-merge' ' wiki_reset && wiki_editpage Foo "1 init 3 5 " false && git clone mediawiki::'"$WIKI_URL"' mw_dir_3 && wiki_editpage Foo "1 init 2 content added on wiki after clone 3 5 " false && ( cd mw_dir_3 && echo "1 init 3 4 content added on git after clone 5 " >Foo.mw && git commit -am "conflicting change on foo" && git pull && git push ) ' test_expect_success 'Git push works after adding a file .mw' ' wiki_reset && git clone mediawiki::'"$WIKI_URL"' mw_dir_4 && wiki_getallpage ref_page_4 && ( cd mw_dir_4 && test_path_is_missing Foo.mw && touch Foo.mw && echo "hello world" >>Foo.mw && git add Foo.mw && git commit -m "Foo" && git push ) && wiki_getallpage ref_page_4 && test_diff_directories mw_dir_4 ref_page_4 ' test_expect_success 'Git push works after editing a file .mw' ' wiki_reset && wiki_editpage "Foo" "page created before the git clone" false && git clone mediawiki::'"$WIKI_URL"' mw_dir_5 && ( cd mw_dir_5 && echo "new line added in the file Foo.mw" >>Foo.mw && git commit -am "edit file Foo.mw" && git push ) && wiki_getallpage ref_page_5 && test_diff_directories mw_dir_5 ref_page_5 ' test_expect_failure 'Git push works after deleting a file' ' wiki_reset && wiki_editpage Foo "wiki page added before git clone" false && git clone mediawiki::'"$WIKI_URL"' mw_dir_6 && ( cd mw_dir_6 && git rm Foo.mw && git commit -am "page Foo.mw deleted" && git push ) && test_must_fail wiki_page_exist Foo ' test_expect_success 'Merge conflict expected and solving it' ' wiki_reset && git clone mediawiki::'"$WIKI_URL"' mw_dir_7 && wiki_editpage Foo "1 conflict 3 wiki 4" false && ( cd mw_dir_7 && echo "1 conflict 2 git 4" >Foo.mw && git add Foo.mw && git commit -m "conflict created" && test_must_fail git pull && "$PERL_PATH" -pi -e "s/[<=>].*//g" Foo.mw && git commit -am "merge conflict solved" && git push ) ' test_expect_failure 'git pull works after deleting a wiki page' ' wiki_reset && wiki_editpage Foo "wiki page added before the git clone" false && git clone mediawiki::'"$WIKI_URL"' mw_dir_8 && wiki_delete_page Foo && ( cd mw_dir_8 && git pull && test_path_is_missing Foo.mw ) ' } (CommandList children: [ (FuncDef name: test_push_pull body: (BraceGroup children: [ (C {(test_expect_success)} {(SQ <"Git pull works after adding a new wiki page">)} {(SQ <"\n"> <"\t\twiki_reset &&\n"> <"\n"> <"\t\tgit clone mediawiki::">) (DQ ($ VSub_Name "$WIKI_URL")) (SQ <" mw_dir_1 &&\n"> <"\t\twiki_editpage Foo \"page created after the git clone\" false &&\n"> <"\n"> <"\t\t(\n"> <"\t\t\tcd mw_dir_1 &&\n"> <"\t\t\tgit pull\n"> <"\t\t) &&\n"> <"\n"> <"\t\twiki_getallpage ref_page_1 &&\n"> <"\t\ttest_diff_directories mw_dir_1 ref_page_1\n"> <"\t"> ) } ) (C {(test_expect_success)} {(SQ <"Git pull works after editing a wiki page">)} { (SQ <"\n"> <"\t\twiki_reset &&\n"> <"\n"> <"\t\twiki_editpage Foo \"page created before the git clone\" false &&\n"> <"\t\tgit clone mediawiki::"> ) (DQ ($ VSub_Name "$WIKI_URL")) (SQ <" mw_dir_2 &&\n"> <"\t\twiki_editpage Foo \"new line added on the wiki\" true &&\n"> <"\n"> <"\t\t(\n"> <"\t\t\tcd mw_dir_2 &&\n"> <"\t\t\tgit pull\n"> <"\t\t) &&\n"> <"\n"> <"\t\twiki_getallpage ref_page_2 &&\n"> <"\t\ttest_diff_directories mw_dir_2 ref_page_2\n"> <"\t"> ) } ) (C {(test_expect_success)} {(SQ <"git pull works on conflict handled by auto-merge">)} { (SQ <"\n"> <"\t\twiki_reset &&\n"> <"\n"> <"\t\twiki_editpage Foo \"1 init\n"> <"3\n"> <"5\n"> <"\t\" false &&\n"> <"\t\tgit clone mediawiki::"> ) (DQ ($ VSub_Name "$WIKI_URL")) (SQ <" mw_dir_3 &&\n"> <"\n"> <"\t\twiki_editpage Foo \"1 init\n"> <"2 content added on wiki after clone\n"> <"3\n"> <"5\n"> <"\t\" false &&\n"> <"\n"> <"\t\t(\n"> <"\t\t\tcd mw_dir_3 &&\n"> <"\t\techo \"1 init\n"> <"3\n"> <"4 content added on git after clone\n"> <"5\n"> <"\" >Foo.mw &&\n"> <"\t\t\tgit commit -am \"conflicting change on foo\" &&\n"> <"\t\t\tgit pull &&\n"> <"\t\t\tgit push\n"> <"\t\t)\n"> <"\t"> ) } ) (C {(test_expect_success)} {(SQ <"Git push works after adding a file .mw">)} {(SQ <"\n"> <"\t\twiki_reset &&\n"> <"\t\tgit clone mediawiki::">) (DQ ($ VSub_Name "$WIKI_URL")) (SQ <" mw_dir_4 &&\n"> <"\t\twiki_getallpage ref_page_4 &&\n"> <"\t\t(\n"> <"\t\t\tcd mw_dir_4 &&\n"> <"\t\t\ttest_path_is_missing Foo.mw &&\n"> <"\t\t\ttouch Foo.mw &&\n"> <"\t\t\techo \"hello world\" >>Foo.mw &&\n"> <"\t\t\tgit add Foo.mw &&\n"> <"\t\t\tgit commit -m \"Foo\" &&\n"> <"\t\t\tgit push\n"> <"\t\t) &&\n"> <"\t\twiki_getallpage ref_page_4 &&\n"> <"\t\ttest_diff_directories mw_dir_4 ref_page_4\n"> <"\t"> ) } ) (C {(test_expect_success)} {(SQ <"Git push works after editing a file .mw">)} { (SQ <"\n"> <"\t\twiki_reset &&\n"> <"\t\twiki_editpage \"Foo\" \"page created before the git clone\" false &&\n"> <"\t\tgit clone mediawiki::"> ) (DQ ($ VSub_Name "$WIKI_URL")) (SQ <" mw_dir_5 &&\n"> <"\n"> <"\t\t(\n"> <"\t\t\tcd mw_dir_5 &&\n"> <"\t\t\techo \"new line added in the file Foo.mw\" >>Foo.mw &&\n"> <"\t\t\tgit commit -am \"edit file Foo.mw\" &&\n"> <"\t\t\tgit push\n"> <"\t\t) &&\n"> <"\n"> <"\t\twiki_getallpage ref_page_5 &&\n"> <"\t\ttest_diff_directories mw_dir_5 ref_page_5\n"> <"\t"> ) } ) (C {(test_expect_failure)} {(SQ <"Git push works after deleting a file">)} { (SQ <"\n"> <"\t\twiki_reset &&\n"> <"\t\twiki_editpage Foo \"wiki page added before git clone\" false &&\n"> <"\t\tgit clone mediawiki::"> ) (DQ ($ VSub_Name "$WIKI_URL")) (SQ <" mw_dir_6 &&\n"> <"\n"> <"\t\t(\n"> <"\t\t\tcd mw_dir_6 &&\n"> <"\t\t\tgit rm Foo.mw &&\n"> <"\t\t\tgit commit -am \"page Foo.mw deleted\" &&\n"> <"\t\t\tgit push\n"> <"\t\t) &&\n"> <"\n"> <"\t\ttest_must_fail wiki_page_exist Foo\n"> <"\t"> ) } ) (C {(test_expect_success)} {(SQ <"Merge conflict expected and solving it">)} {(SQ <"\n"> <"\t\twiki_reset &&\n"> <"\n"> <"\t\tgit clone mediawiki::">) (DQ ($ VSub_Name "$WIKI_URL")) (SQ <" mw_dir_7 &&\n"> <"\t\twiki_editpage Foo \"1 conflict\n"> <"3 wiki\n"> <"4\" false &&\n"> <"\n"> <"\t\t(\n"> <"\t\t\tcd mw_dir_7 &&\n"> <"\t\techo \"1 conflict\n"> <"2 git\n"> <"4\" >Foo.mw &&\n"> <"\t\t\tgit add Foo.mw &&\n"> <"\t\t\tgit commit -m \"conflict created\" &&\n"> <"\t\t\ttest_must_fail git pull &&\n"> <"\t\t\t\"$PERL_PATH\" -pi -e \"s/[<=>].*//g\" Foo.mw &&\n"> <"\t\t\tgit commit -am \"merge conflict solved\" &&\n"> <"\t\t\tgit push\n"> <"\t\t)\n"> <"\t"> ) } ) (C {(test_expect_failure)} {(SQ <"git pull works after deleting a wiki page">)} { (SQ <"\n"> <"\t\twiki_reset &&\n"> <"\t\twiki_editpage Foo \"wiki page added before the git clone\" false &&\n"> <"\t\tgit clone mediawiki::"> ) (DQ ($ VSub_Name "$WIKI_URL")) (SQ <" mw_dir_8 &&\n"> <"\n"> <"\t\twiki_delete_page Foo &&\n"> <"\t\t(\n"> <"\t\t\tcd mw_dir_8 &&\n"> <"\t\t\tgit pull &&\n"> <"\t\t\ttest_path_is_missing Foo.mw\n"> <"\t\t)\n"> <"\t"> ) } ) ] spids: [5] ) spids: [0 4] ) ] )