(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'test_description='> name:test_description) op: assign_op.Equal rhs: {(SQ <'Test export of commits to CVS'>)} spids: [12] ) ] redirects: [] ) (C {<.>} {<'./test-lib.sh'>}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.Pipeline children: [(C {<test_have_prereq>} {<PERL>})] negated: T stderr_indices: [] ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'skip_all='> name:skip_all) op: assign_op.Equal rhs: {(SQ <'skipping git cvsexportcommit tests, perl not available'>)} spids: [35] ) ] redirects: [] ) (C {<test_done>}) ] spids: [23 32] ) ] else_action: [] redirects: [] ) (command.Simple words: [{<cvs>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'/dev/null'>}) (redir op:<Id.Redir_GreatAnd '2>&'> loc:(redir_loc.Fd fd:2) arg:{<1>}) ] more_env: [] do_fork: T ) (command.If arms: [ (if_arm cond: (condition.Shell commands:[(C {<test>} {($ Id.VSub_QMark '?')} {<-ne>} {<1>})]) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'skip_all='> name:skip_all) op: assign_op.Equal rhs: {(SQ <'skipping git cvsexportcommit tests, cvs not found'>)} spids: [67] ) ] redirects: [] ) (C {<test_done>}) ] spids: [54 64] ) ] else_action: [] redirects: [] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'CVSROOT='> name:CVSROOT) op: assign_op.Equal rhs: {($ Id.VSub_DollarName PWD) <'/tmpcvsroot'>} spids: [78] ) ] redirects: [] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'CVSWORK='> name:CVSWORK) op: assign_op.Equal rhs: {($ Id.VSub_DollarName PWD) <'/cvswork'>} spids: [82] ) ] redirects: [] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'GIT_DIR='> name:GIT_DIR) op: assign_op.Equal rhs: {($ Id.VSub_DollarName PWD) <'/.git'>} spids: [86] ) ] redirects: [] ) (C {<export>} {<CVSROOT>} {<CVSWORK>} {<GIT_DIR>}) (C {<rm>} {<-rf>} {(DQ ($ Id.VSub_DollarName CVSROOT))} {(DQ ($ Id.VSub_DollarName CVSWORK))}) (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DPipe] children: [ (C {<cvs>} {<init>}) (C {<test>} {<-d>} {(DQ ($ Id.VSub_DollarName CVSROOT))}) (C {<cvs>} {<-Q>} {<co>} {<-d>} {(DQ ($ Id.VSub_DollarName CVSWORK))} {<.>}) (command.Simple words: [{<echo>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<empty>})] more_env: [] do_fork: T ) (C {<git>} {<add>} {<empty>}) (command.Simple words: [{<git>} {<commit>} {<-q>} {<-a>} {<-m>} {(DQ <Initial>)}] redirects: [(redir op:<Id.Redir_Great '2>'> loc:(redir_loc.Fd fd:2) arg:{<'/dev/null'>})] more_env: [] do_fork: T ) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] ) (command.ShFunction name: check_entries body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Pipeline children: [ (C {<sed>} {<-ne>} {(SQ <'/^\\//p'>)} {(DQ ($ Id.VSub_Number 1) <'/CVS/Entries'>)}) (C {<sort>}) (command.Simple words: [{<cut>} {<'-d/'>} {<-f2> <Id.Lit_Comma ','> <3> <Id.Lit_Comma ','> <5>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<actual>})] more_env: [] do_fork: T ) ] negated: F stderr_indices: [] ) (command.If arms: [ (if_arm cond: (condition.Shell commands:[(C {<test>} {<-z>} {(DQ ($ Id.VSub_Number 2))})]) action: [ (command.Simple words: [] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<expected>} ) ] more_env: [] do_fork: F ) ] spids: [228 239] ) ] else_action: [ (command.Pipeline children: [ (C {<printf>} {(SQ <'%s\\n'>)} {(DQ ($ Id.VSub_Number 2))}) (command.Simple words: [{<tr>} {(SQ <'|'>)} {(SQ <'\\012'>)}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<expected>} ) ] more_env: [] do_fork: T ) ] negated: F stderr_indices: [] ) ] redirects: [] ) (C {<test_cmp>} {<expected>} {<actual>}) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (C {<test_expect_success>} {(SQ <'New file'>)} { (SQ <'mkdir A B C D E F &&\n'> <' echo hello1 >A/newfile1.txt &&\n'> <' echo hello2 >B/newfile2.txt &&\n'> <' cp "$TEST_DIRECTORY"/test-binary-1.png C/newfile3.png &&\n'> <' cp "$TEST_DIRECTORY"/test-binary-1.png D/newfile4.png &&\n'> <' git add A/newfile1.txt &&\n'> <' git add B/newfile2.txt &&\n'> <' git add C/newfile3.png &&\n'> <' git add D/newfile4.png &&\n'> <' git commit -a -m "Test: New file" &&\n'> <' id=$(git rev-list --max-count=1 HEAD) &&\n'> <' (cd "$CVSWORK" &&\n'> <' git cvsexportcommit -c $id &&\n'> <' check_entries A "newfile1.txt/1.1/" &&\n'> <' check_entries B "newfile2.txt/1.1/" &&\n'> <' check_entries C "newfile3.png/1.1/-kb" &&\n'> <' check_entries D "newfile4.png/1.1/-kb" &&\n'> <' test_cmp A/newfile1.txt ../A/newfile1.txt &&\n'> <' test_cmp B/newfile2.txt ../B/newfile2.txt &&\n'> <' test_cmp C/newfile3.png ../C/newfile3.png &&\n'> <' test_cmp D/newfile4.png ../D/newfile4.png\n'> <' )'> ) } ) (C {<test_expect_success>} {(SQ <'Remove two files, add two and update two'>)} { (SQ <'echo Hello1 >>A/newfile1.txt &&\n'> <' rm -f B/newfile2.txt &&\n'> <' rm -f C/newfile3.png &&\n'> <' echo Hello5 >E/newfile5.txt &&\n'> <' cp "$TEST_DIRECTORY"/test-binary-2.png D/newfile4.png &&\n'> <' cp "$TEST_DIRECTORY"/test-binary-1.png F/newfile6.png &&\n'> <' git add E/newfile5.txt &&\n'> <' git add F/newfile6.png &&\n'> <' git commit -a -m "Test: Remove, add and update" &&\n'> <' id=$(git rev-list --max-count=1 HEAD) &&\n'> <' (cd "$CVSWORK" &&\n'> <' git cvsexportcommit -c $id &&\n'> <' check_entries A "newfile1.txt/1.2/" &&\n'> <' check_entries B "" &&\n'> <' check_entries C "" &&\n'> <' check_entries D "newfile4.png/1.2/-kb" &&\n'> <' check_entries E "newfile5.txt/1.1/" &&\n'> <' check_entries F "newfile6.png/1.1/-kb" &&\n'> <' test_cmp A/newfile1.txt ../A/newfile1.txt &&\n'> <' test_cmp D/newfile4.png ../D/newfile4.png &&\n'> <' test_cmp E/newfile5.txt ../E/newfile5.txt &&\n'> <' test_cmp F/newfile6.png ../F/newfile6.png\n'> <' )'> ) } ) (C {<test_expect_success>} {(SQ <'Fail to change binary more than one generation old'>)} { (SQ <'cat F/newfile6.png >>D/newfile4.png &&\n'> <' git commit -a -m "generatiion 1" &&\n'> <' cat F/newfile6.png >>D/newfile4.png &&\n'> <' git commit -a -m "generation 2" &&\n'> <' id=$(git rev-list --max-count=1 HEAD) &&\n'> <' (cd "$CVSWORK" &&\n'> <' test_must_fail git cvsexportcommit -c $id\n'> <' )'> ) } ) (C {<test_expect_success>} {(SQ <'Remove only binary files'>)} { (SQ <'git reset --hard HEAD^^ &&\n'> <' rm -f D/newfile4.png &&\n'> <' git commit -a -m "test: remove only a binary file" &&\n'> <' id=$(git rev-list --max-count=1 HEAD) &&\n'> <' (cd "$CVSWORK" &&\n'> <' git cvsexportcommit -c $id &&\n'> <' check_entries A "newfile1.txt/1.2/" &&\n'> <' check_entries B "" &&\n'> <' check_entries C "" &&\n'> <' check_entries D "" &&\n'> <' check_entries E "newfile5.txt/1.1/" &&\n'> <' check_entries F "newfile6.png/1.1/-kb" &&\n'> <' test_cmp A/newfile1.txt ../A/newfile1.txt &&\n'> <' test_cmp E/newfile5.txt ../E/newfile5.txt &&\n'> <' test_cmp F/newfile6.png ../F/newfile6.png\n'> <' )'> ) } ) (C {<test_expect_success>} {(SQ <'Remove only a text file'>)} { (SQ <'rm -f A/newfile1.txt &&\n'> <' git commit -a -m "test: remove only a binary file" &&\n'> <' id=$(git rev-list --max-count=1 HEAD) &&\n'> <' (cd "$CVSWORK" &&\n'> <' git cvsexportcommit -c $id &&\n'> <' check_entries A "" &&\n'> <' check_entries B "" &&\n'> <' check_entries C "" &&\n'> <' check_entries D "" &&\n'> <' check_entries E "newfile5.txt/1.1/" &&\n'> <' check_entries F "newfile6.png/1.1/-kb" &&\n'> <' test_cmp E/newfile5.txt ../E/newfile5.txt &&\n'> <' test_cmp F/newfile6.png ../F/newfile6.png\n'> <' )'> ) } ) (C {<test_expect_success>} {(SQ <'New file with spaces in file name'>)} { (SQ <'mkdir "G g" &&\n'> <' echo ok then >"G g/with spaces.txt" &&\n'> <' git add "G g/with spaces.txt" && \\\n'> <' cp "$TEST_DIRECTORY"/test-binary-1.png "G g/with spaces.png" && \\\n'> <' git add "G g/with spaces.png" &&\n'> <' git commit -a -m "With spaces" &&\n'> <' id=$(git rev-list --max-count=1 HEAD) &&\n'> <' (cd "$CVSWORK" &&\n'> <' git cvsexportcommit -c $id &&\n'> <' check_entries "G g" "with spaces.png/1.1/-kb|with spaces.txt/1.1/"\n'> <' )'> ) } ) (C {<test_expect_success>} {(SQ <'Update file with spaces in file name'>)} { (SQ <'echo Ok then >>"G g/with spaces.txt" &&\n'> <' cat "$TEST_DIRECTORY"/test-binary-1.png >>"G g/with spaces.png" && \\\n'> <' git add "G g/with spaces.png" &&\n'> <' git commit -a -m "Update with spaces" &&\n'> <' id=$(git rev-list --max-count=1 HEAD) &&\n'> <' (cd "$CVSWORK" &&\n'> <' git cvsexportcommit -c $id\n'> <' check_entries "G g" "with spaces.png/1.2/-kb|with spaces.txt/1.2/"\n'> <' )'> ) } ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'p='> name:p) op: assign_op.Equal rhs: { (DQ < 'Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö' > ) } spids: [543] ) ] redirects: [] ) (C {<mkdir>} {<-p>} {(DQ <'tst/'> ($ Id.VSub_DollarName p))}) (command.Simple words: [{<date>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {(DQ <'tst/'> ($ Id.VSub_DollarName p) <'/day'>)} ) ] more_env: [] do_fork: T ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'found='> name:found) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<find>} {<tst>} {<-type>} {<f>} {<-print>}) right: <Id.Eof_RParen _> ) } spids: [575] ) ] redirects: [] ) (C {<test>} {(DQ <z> ($ Id.VSub_DollarName found))} {<Id.Lit_Equals '='>} {(DQ <'ztst/'> ($ Id.VSub_DollarName p) <'/day'>)} ) (C {<rm>} {<-fr>} {<tst>}) ] ) ] ) action: [ (C {<test_expect_success>} {<Id.KW_Bang '!'> <MINGW>} {(SQ <'File with non-ascii file name'>)} { (SQ < 'mkdir -p Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö &&\n' > < ' echo Foo >Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&\n' > < ' git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&\n' > < ' cp "$TEST_DIRECTORY"/test-binary-1.png Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&\n' > < ' git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&\n' > <' git commit -a -m "Går det så går det" && \\\n'> <' id=$(git rev-list --max-count=1 HEAD) &&\n'> <' (cd "$CVSWORK" &&\n'> <' git cvsexportcommit -v -c $id &&\n'> <' check_entries \\\n'> < ' "Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö" \\\n' > <' "gårdetsågårdet.png/1.1/-kb|gårdetsågårdet.txt/1.1/"\n'> <' )'> ) } ) ] spids: [541 615] ) ] else_action: [] redirects: [] ) (C {<rm>} {<-fr>} {<tst>}) (C {<test_expect_success>} {(SQ <'Mismatching patch should fail'>)} { (SQ <'date >>"E/newfile5.txt" &&\n'> <' git add "E/newfile5.txt" &&\n'> <' git commit -a -m "Update one" &&\n'> <' date >>"E/newfile5.txt" &&\n'> <' git add "E/newfile5.txt" &&\n'> <' git commit -a -m "Update two" &&\n'> <' id=$(git rev-list --max-count=1 HEAD) &&\n'> <' (cd "$CVSWORK" &&\n'> <' test_must_fail git cvsexportcommit -c $id\n'> <' )'> ) } ) (C {<test_expect_success>} {<FILEMODE>} {(SQ <'Retain execute bit'>)} { (SQ <'mkdir G &&\n'> <' echo executeon >G/on &&\n'> <' chmod +x G/on &&\n'> <' echo executeoff >G/off &&\n'> <' git add G/on &&\n'> <' git add G/off &&\n'> <' git commit -a -m "Execute test" &&\n'> <' (cd "$CVSWORK" &&\n'> <' git cvsexportcommit -c HEAD\n'> <' test -x G/on &&\n'> <' ! test -x G/off\n'> <' )'> ) } ) (C {<test_expect_success>} {(SQ <'-w option should work with relative GIT_DIR'>)} { (SQ <'\n'> <' mkdir W &&\n'> <' echo foobar >W/file1.txt &&\n'> <' echo bazzle >W/file2.txt &&\n'> <' git add W/file1.txt &&\n'> <' git add W/file2.txt &&\n'> <' git commit -m "More updates" &&\n'> <' id=$(git rev-list --max-count=1 HEAD) &&\n'> <' (cd "$GIT_DIR" &&\n'> <' GIT_DIR=. git cvsexportcommit -w "$CVSWORK" -c $id &&\n'> <' check_entries "$CVSWORK/W" "file1.txt/1.1/|file2.txt/1.1/" &&\n'> <' test_cmp "$CVSWORK/W/file1.txt" ../W/file1.txt &&\n'> <' test_cmp "$CVSWORK/W/file2.txt" ../W/file2.txt\n'> <' )\n'> ) } ) (C {<test_expect_success>} {(SQ <'check files before directories'>)} { (SQ <'\n'> <'\n'> <'\techo Notes > release-notes &&\n'> <'\tgit add release-notes &&\n'> <'\tgit commit -m "Add release notes" release-notes &&\n'> <'\tid=$(git rev-parse HEAD) &&\n'> <'\tgit cvsexportcommit -w "$CVSWORK" -c $id &&\n'> <'\n'> <'\techo new > DS &&\n'> <'\techo new > E/DS &&\n'> <'\techo modified > release-notes &&\n'> <'\tgit add DS E/DS release-notes &&\n'> <'\tgit commit -m "Add two files with the same basename" &&\n'> <'\tid=$(git rev-parse HEAD) &&\n'> <'\tgit cvsexportcommit -w "$CVSWORK" -c $id &&\n'> <'\tcheck_entries "$CVSWORK/E" "DS/1.1/|newfile5.txt/1.1/" &&\n'> <'\tcheck_entries "$CVSWORK" "DS/1.1/|release-notes/1.2/" &&\n'> <'\ttest_cmp "$CVSWORK/DS" DS &&\n'> <'\ttest_cmp "$CVSWORK/E/DS" E/DS &&\n'> <'\ttest_cmp "$CVSWORK/release-notes" release-notes\n'> <'\n'> ) } ) (C {<test_expect_success>} {(SQ <'re-commit a removed filename which remains in CVS attic'>)} { (SQ <'\n'> <'\n'> <' (cd "$CVSWORK" &&\n'> <' echo >attic_gremlin &&\n'> <' cvs -Q add attic_gremlin &&\n'> <' cvs -Q ci -m "added attic_gremlin" &&\n'> <' rm attic_gremlin &&\n'> <' cvs -Q rm attic_gremlin &&\n'> <' cvs -Q ci -m "removed attic_gremlin") &&\n'> <'\n'> <' echo > attic_gremlin &&\n'> <' git add attic_gremlin &&\n'> <' git commit -m "Added attic_gremlin" &&\n'> <'\tgit cvsexportcommit -w "$CVSWORK" -c HEAD &&\n'> <' (cd "$CVSWORK"; cvs -Q update -d) &&\n'> <' test -f "$CVSWORK/attic_gremlin"\n'> ) } ) (C {<test_expect_success>} {(SQ <'commit a file with leading spaces in the name'>)} { (SQ <'\n'> <'\n'> <'\techo space > " space" &&\n'> <'\tgit add " space" &&\n'> <'\tgit commit -m "Add a file with a leading space" &&\n'> <'\tid=$(git rev-parse HEAD) &&\n'> <'\tgit cvsexportcommit -w "$CVSWORK" -c $id &&\n'> < '\tcheck_entries "$CVSWORK" " space/1.1/|DS/1.1/|attic_gremlin/1.3/|release-notes/1.2/" &&\n' > <'\ttest_cmp "$CVSWORK/ space" " space"\n'> <'\n'> ) } ) (C {<test_expect_success>} {(SQ <'use the same checkout for Git and CVS'>)} { (SQ <'\n'> <'\n'> <'\t(mkdir shared &&\n'> <'\t cd shared &&\n'> <'\t sane_unset GIT_DIR &&\n'> <'\t cvs co . &&\n'> <'\t git init &&\n'> <'\t git add " space" &&\n'> <'\t git commit -m "fake initial commit" &&\n'> <'\t echo Hello >> " space" &&\n'> <'\t git commit -m "Another change" " space" &&\n'> <'\t git cvsexportcommit -W -p -u -c HEAD &&\n'> <'\t grep Hello " space" &&\n'> <'\t git diff-files)\n'> <'\n'> ) } ) (C {<test_done>}) ] )