#!/bin/sh global test_description := ''git cvsimport basic tests'' source ./lib-cvs.sh test_expect_success PERL 'setup cvsroot environment' ' CVSROOT=$(pwd)/cvsroot && export CVSROOT ' test_expect_success PERL 'setup cvsroot' '$CVS init' test_expect_success PERL 'setup a cvs module' ' mkdir "$CVSROOT/module" && $CVS co -d module-cvs module && (cd module-cvs && cat <o_fortuna && O Fortuna velut luna statu variabilis, semper crescis aut decrescis; vita detestabilis nunc obdurat et tunc curat ludo mentis aciem, egestatem, potestatem dissolvit ut glaciem. EOF $CVS add o_fortuna && cat <message && add "O Fortuna" lyrics These public domain lyrics make an excellent sample text. EOF $CVS commit -F message ) ' test_expect_success PERL 'import a trivial module' ' git cvsimport -a -R -z 0 -C module-git module && test_cmp module-cvs/o_fortuna module-git/o_fortuna ' test_expect_success PERL 'pack refs' '(cd module-git && git gc)' test_expect_success PERL 'initial import has correct .git/cvs-revisions' ' (cd module-git && git log --format="o_fortuna 1.1 %H" -1) > expected && test_cmp expected module-git/.git/cvs-revisions ' test_expect_success PERL 'update cvs module' ' (cd module-cvs && cat <o_fortuna && O Fortune, like the moon you are changeable, ever waxing and waning; hateful life first oppresses and then soothes as fancy takes it; poverty and power it melts them like ice. EOF cat <message && translate to English My Latin is terrible. EOF $CVS commit -F message ) ' test_expect_success PERL 'update git module' ' (cd module-git && git config cvsimport.trackRevisions true && git cvsimport -a -z 0 module && git merge origin ) && test_cmp module-cvs/o_fortuna module-git/o_fortuna ' test_expect_success PERL 'update has correct .git/cvs-revisions' ' (cd module-git && git log --format="o_fortuna 1.1 %H" -1 HEAD^ && git log --format="o_fortuna 1.2 %H" -1 HEAD) > expected && test_cmp expected module-git/.git/cvs-revisions ' test_expect_success PERL 'update cvs module' ' (cd module-cvs && echo 1 >tick && $CVS add tick && $CVS commit -m 1 ) ' test_expect_success PERL 'cvsimport.module config works' ' (cd module-git && git config cvsimport.module module && git config cvsimport.trackRevisions true && git cvsimport -a -z0 && git merge origin ) && test_cmp module-cvs/tick module-git/tick ' test_expect_success PERL 'second update has correct .git/cvs-revisions' ' (cd module-git && git log --format="o_fortuna 1.1 %H" -1 HEAD^^ && git log --format="o_fortuna 1.2 %H" -1 HEAD^ git log --format="tick 1.1 %H" -1 HEAD) > expected && test_cmp expected module-git/.git/cvs-revisions ' test_expect_success PERL 'import from a CVS working tree' ' $CVS co -d import-from-wt module && (cd import-from-wt && git config cvsimport.trackRevisions false && git cvsimport -a -z0 && echo 1 >expect && git log -1 --pretty=format:%s%n >actual && test_cmp actual expect ) ' test_expect_success PERL 'no .git/cvs-revisions created by default' ' ! test -e import-from-wt/.git/cvs-revisions ' test_expect_success PERL 'test entire HEAD' 'test_cmp_branch_tree master' test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"git cvsimport basic tests">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./lib-cvs.sh)}) (C {(test_expect_success)} {(PERL)} {(SQ <"setup cvsroot environment">)} {(SQ <"\n"> <"\tCVSROOT=$(pwd)/cvsroot &&\n"> <"\texport CVSROOT\n">)} ) (C {(test_expect_success)} {(PERL)} {(SQ <"setup cvsroot">)} {(SQ <"$CVS init">)}) (C {(test_expect_success)} {(PERL)} {(SQ <"setup a cvs module">)} { (SQ <"\n"> <"\n"> <"\tmkdir \"$CVSROOT/module\" &&\n"> <"\t$CVS co -d module-cvs module &&\n"> <"\t(cd module-cvs &&\n"> <"\tcat <o_fortuna &&\n"> <"O Fortuna\n"> <"velut luna\n"> <"statu variabilis,\n"> <"\n"> <"semper crescis\n"> <"aut decrescis;\n"> <"vita detestabilis\n"> <"\n"> <"nunc obdurat\n"> <"et tunc curat\n"> <"ludo mentis aciem,\n"> <"\n"> <"egestatem,\n"> <"potestatem\n"> <"dissolvit ut glaciem.\n"> <"EOF\n"> <"\t$CVS add o_fortuna &&\n"> <"\tcat <message &&\n"> <"add \"O Fortuna\" lyrics\n"> <"\n"> <"These public domain lyrics make an excellent sample text.\n"> <"EOF\n"> <"\t$CVS commit -F message\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(PERL)} {(SQ <"import a trivial module">)} { (SQ <"\n"> <"\n"> <"\tgit cvsimport -a -R -z 0 -C module-git module &&\n"> <"\ttest_cmp module-cvs/o_fortuna module-git/o_fortuna\n"> <"\n"> ) } ) (C {(test_expect_success)} {(PERL)} {(SQ <"pack refs">)} {(SQ <"(cd module-git && git gc)">)}) (C {(test_expect_success)} {(PERL)} {(SQ <"initial import has correct .git/cvs-revisions">)} { (SQ <"\n"> <"\n"> <"\t(cd module-git &&\n"> <"\t git log --format=\"o_fortuna 1.1 %H\" -1) > expected &&\n"> <"\ttest_cmp expected module-git/.git/cvs-revisions\n"> ) } ) (C {(test_expect_success)} {(PERL)} {(SQ <"update cvs module">)} { (SQ <"\n"> <"\t(cd module-cvs &&\n"> <"\tcat <o_fortuna &&\n"> <"O Fortune,\n"> <"like the moon\n"> <"you are changeable,\n"> <"\n"> <"ever waxing\n"> <"and waning;\n"> <"hateful life\n"> <"\n"> <"first oppresses\n"> <"and then soothes\n"> <"as fancy takes it;\n"> <"\n"> <"poverty\n"> <"and power\n"> <"it melts them like ice.\n"> <"EOF\n"> <"\tcat <message &&\n"> <"translate to English\n"> <"\n"> <"My Latin is terrible.\n"> <"EOF\n"> <"\t$CVS commit -F message\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(PERL)} {(SQ <"update git module">)} { (SQ <"\n"> <"\n"> <"\t(cd module-git &&\n"> <"\tgit config cvsimport.trackRevisions true &&\n"> <"\tgit cvsimport -a -z 0 module &&\n"> <"\tgit merge origin\n"> <"\t) &&\n"> <"\ttest_cmp module-cvs/o_fortuna module-git/o_fortuna\n"> <"\n"> ) } ) (C {(test_expect_success)} {(PERL)} {(SQ <"update has correct .git/cvs-revisions">)} { (SQ <"\n"> <"\n"> <"\t(cd module-git &&\n"> <"\t git log --format=\"o_fortuna 1.1 %H\" -1 HEAD^ &&\n"> <"\t git log --format=\"o_fortuna 1.2 %H\" -1 HEAD) > expected &&\n"> <"\ttest_cmp expected module-git/.git/cvs-revisions\n"> ) } ) (C {(test_expect_success)} {(PERL)} {(SQ <"update cvs module">)} { (SQ <"\n"> <"\n"> <"\t(cd module-cvs &&\n"> <"\t\techo 1 >tick &&\n"> <"\t\t$CVS add tick &&\n"> <"\t\t$CVS commit -m 1\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(PERL)} {(SQ <"cvsimport.module config works">)} { (SQ <"\n"> <"\n"> <"\t(cd module-git &&\n"> <"\t\tgit config cvsimport.module module &&\n"> <"\t\tgit config cvsimport.trackRevisions true &&\n"> <"\t\tgit cvsimport -a -z0 &&\n"> <"\t\tgit merge origin\n"> <"\t) &&\n"> <"\ttest_cmp module-cvs/tick module-git/tick\n"> <"\n"> ) } ) (C {(test_expect_success)} {(PERL)} {(SQ <"second update has correct .git/cvs-revisions">)} { (SQ <"\n"> <"\n"> <"\t(cd module-git &&\n"> <"\t git log --format=\"o_fortuna 1.1 %H\" -1 HEAD^^ &&\n"> <"\t git log --format=\"o_fortuna 1.2 %H\" -1 HEAD^\n"> <"\t git log --format=\"tick 1.1 %H\" -1 HEAD) > expected &&\n"> <"\ttest_cmp expected module-git/.git/cvs-revisions\n"> ) } ) (C {(test_expect_success)} {(PERL)} {(SQ <"import from a CVS working tree">)} { (SQ <"\n"> <"\n"> <"\t$CVS co -d import-from-wt module &&\n"> <"\t(cd import-from-wt &&\n"> <"\t\tgit config cvsimport.trackRevisions false &&\n"> <"\t\tgit cvsimport -a -z0 &&\n"> <"\t\techo 1 >expect &&\n"> <"\t\tgit log -1 --pretty=format:%s%n >actual &&\n"> <"\t\ttest_cmp actual expect\n"> <"\t)\n"> <"\n"> ) } ) (C {(test_expect_success)} {(PERL)} {(SQ <"no .git/cvs-revisions created by default">)} {(SQ <"\n"> <"\n"> <"\t! test -e import-from-wt/.git/cvs-revisions\n"> <"\n">)} ) (C {(test_expect_success)} {(PERL)} {(SQ <"test entire HEAD">)} {(SQ <"test_cmp_branch_tree master">)}) (C {(test_done)}) ] )