#!/bin/sh # # Copyright (c) Robin Rosenberg # global test_description := ''Test export of commits to CVS'' source ./test-lib.sh if ! test_have_prereq PERL { global skip_all := ''skipping git cvsexportcommit tests, perl not available'' test_done } cvs >/dev/null !2 > !1 if test $Status -ne 1 { global skip_all := ''skipping git cvsexportcommit tests, cvs not found'' test_done } global CVSROOT := "$PWD/tmpcvsroot" global CVSWORK := "$PWD/cvswork" global GIT_DIR := "$PWD/.git" export CVSROOT CVSWORK GIT_DIR rm -rf $CVSROOT $CVSWORK cvs init && test -d $CVSROOT && cvs -Q co -d $CVSWORK . && echo >empty && git add empty && git commit -q -a -m "Initial" !2 >/dev/null || exit 1 proc check_entries { # $1 == directory, $2 == expected sed -ne '/^\//p' "$1/CVS/Entries" | sort | cut -d/ -f2,3,5 >actual if test -z $2 { >expected } else { printf '%s\n' $2 | tr '|' '\012' >expected } test_cmp expected actual } test_expect_success \ 'New file' \ 'mkdir A B C D E F && echo hello1 >A/newfile1.txt && echo hello2 >B/newfile2.txt && cp "$TEST_DIRECTORY"/test-binary-1.png C/newfile3.png && cp "$TEST_DIRECTORY"/test-binary-1.png D/newfile4.png && git add A/newfile1.txt && git add B/newfile2.txt && git add C/newfile3.png && git add D/newfile4.png && git commit -a -m "Test: New file" && id=$(git rev-list --max-count=1 HEAD) && (cd "$CVSWORK" && git cvsexportcommit -c $id && check_entries A "newfile1.txt/1.1/" && check_entries B "newfile2.txt/1.1/" && check_entries C "newfile3.png/1.1/-kb" && check_entries D "newfile4.png/1.1/-kb" && test_cmp A/newfile1.txt ../A/newfile1.txt && test_cmp B/newfile2.txt ../B/newfile2.txt && test_cmp C/newfile3.png ../C/newfile3.png && test_cmp D/newfile4.png ../D/newfile4.png )' test_expect_success \ 'Remove two files, add two and update two' \ 'echo Hello1 >>A/newfile1.txt && rm -f B/newfile2.txt && rm -f C/newfile3.png && echo Hello5 >E/newfile5.txt && cp "$TEST_DIRECTORY"/test-binary-2.png D/newfile4.png && cp "$TEST_DIRECTORY"/test-binary-1.png F/newfile6.png && git add E/newfile5.txt && git add F/newfile6.png && git commit -a -m "Test: Remove, add and update" && id=$(git rev-list --max-count=1 HEAD) && (cd "$CVSWORK" && git cvsexportcommit -c $id && check_entries A "newfile1.txt/1.2/" && check_entries B "" && check_entries C "" && check_entries D "newfile4.png/1.2/-kb" && check_entries E "newfile5.txt/1.1/" && check_entries F "newfile6.png/1.1/-kb" && test_cmp A/newfile1.txt ../A/newfile1.txt && test_cmp D/newfile4.png ../D/newfile4.png && test_cmp E/newfile5.txt ../E/newfile5.txt && test_cmp F/newfile6.png ../F/newfile6.png )' # Should fail (but only on the git cvsexportcommit stage) test_expect_success \ 'Fail to change binary more than one generation old' \ 'cat F/newfile6.png >>D/newfile4.png && git commit -a -m "generatiion 1" && cat F/newfile6.png >>D/newfile4.png && git commit -a -m "generation 2" && id=$(git rev-list --max-count=1 HEAD) && (cd "$CVSWORK" && test_must_fail git cvsexportcommit -c $id )' #test_expect_success \ # 'Fail to remove binary file more than one generation old' \ # 'git reset --hard HEAD^ && # cat F/newfile6.png >>D/newfile4.png && # git commit -a -m "generation 2 (again)" && # rm -f D/newfile4.png && # git commit -a -m "generation 3" && # id=$(git rev-list --max-count=1 HEAD) && # (cd "$CVSWORK" && # test_must_fail git cvsexportcommit -c $id # )' # We reuse the state from two tests back here # This test is here because a patch for only binary files will # fail with gnu patch, so cvsexportcommit must handle that. test_expect_success \ 'Remove only binary files' \ 'git reset --hard HEAD^^ && rm -f D/newfile4.png && git commit -a -m "test: remove only a binary file" && id=$(git rev-list --max-count=1 HEAD) && (cd "$CVSWORK" && git cvsexportcommit -c $id && check_entries A "newfile1.txt/1.2/" && check_entries B "" && check_entries C "" && check_entries D "" && check_entries E "newfile5.txt/1.1/" && check_entries F "newfile6.png/1.1/-kb" && test_cmp A/newfile1.txt ../A/newfile1.txt && test_cmp E/newfile5.txt ../E/newfile5.txt && test_cmp F/newfile6.png ../F/newfile6.png )' test_expect_success \ 'Remove only a text file' \ 'rm -f A/newfile1.txt && git commit -a -m "test: remove only a binary file" && id=$(git rev-list --max-count=1 HEAD) && (cd "$CVSWORK" && git cvsexportcommit -c $id && check_entries A "" && check_entries B "" && check_entries C "" && check_entries D "" && check_entries E "newfile5.txt/1.1/" && check_entries F "newfile6.png/1.1/-kb" && test_cmp E/newfile5.txt ../E/newfile5.txt && test_cmp F/newfile6.png ../F/newfile6.png )' test_expect_success \ 'New file with spaces in file name' \ 'mkdir "G g" && echo ok then >"G g/with spaces.txt" && git add "G g/with spaces.txt" && \ cp "$TEST_DIRECTORY"/test-binary-1.png "G g/with spaces.png" && \ git add "G g/with spaces.png" && git commit -a -m "With spaces" && id=$(git rev-list --max-count=1 HEAD) && (cd "$CVSWORK" && git cvsexportcommit -c $id && check_entries "G g" "with spaces.png/1.1/-kb|with spaces.txt/1.1/" )' test_expect_success \ 'Update file with spaces in file name' \ 'echo Ok then >>"G g/with spaces.txt" && cat "$TEST_DIRECTORY"/test-binary-1.png >>"G g/with spaces.png" && \ git add "G g/with spaces.png" && git commit -a -m "Update with spaces" && id=$(git rev-list --max-count=1 HEAD) && (cd "$CVSWORK" && git cvsexportcommit -c $id check_entries "G g" "with spaces.png/1.2/-kb|with spaces.txt/1.2/" )' # Some filesystems mangle pathnames with UTF-8 characters -- # check and skip if global 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/å/ä/ö'" && mkdir -p "tst/$p" && date >"tst/$p/day" && global found := $[find tst -type f -print] && test "z$found" = "ztst/$p/day" && rm -fr tst { # This test contains UTF-8 characters test_expect_success !MINGW \ 'File with non-ascii file name' \ '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/å/ä/ö && 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 && 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 && 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 && 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 && git commit -a -m "Går det så går det" && \ id=$(git rev-list --max-count=1 HEAD) && (cd "$CVSWORK" && git cvsexportcommit -v -c $id && check_entries \ "Å/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/1.1/-kb|gårdetsågårdet.txt/1.1/" )' } rm -fr tst test_expect_success \ 'Mismatching patch should fail' \ 'date >>"E/newfile5.txt" && git add "E/newfile5.txt" && git commit -a -m "Update one" && date >>"E/newfile5.txt" && git add "E/newfile5.txt" && git commit -a -m "Update two" && id=$(git rev-list --max-count=1 HEAD) && (cd "$CVSWORK" && test_must_fail git cvsexportcommit -c $id )' test_expect_success FILEMODE \ 'Retain execute bit' \ 'mkdir G && echo executeon >G/on && chmod +x G/on && echo executeoff >G/off && git add G/on && git add G/off && git commit -a -m "Execute test" && (cd "$CVSWORK" && git cvsexportcommit -c HEAD test -x G/on && ! test -x G/off )' test_expect_success '-w option should work with relative GIT_DIR' ' mkdir W && echo foobar >W/file1.txt && echo bazzle >W/file2.txt && git add W/file1.txt && git add W/file2.txt && git commit -m "More updates" && id=$(git rev-list --max-count=1 HEAD) && (cd "$GIT_DIR" && GIT_DIR=. git cvsexportcommit -w "$CVSWORK" -c $id && check_entries "$CVSWORK/W" "file1.txt/1.1/|file2.txt/1.1/" && test_cmp "$CVSWORK/W/file1.txt" ../W/file1.txt && test_cmp "$CVSWORK/W/file2.txt" ../W/file2.txt ) ' test_expect_success 'check files before directories' ' echo Notes > release-notes && git add release-notes && git commit -m "Add release notes" release-notes && id=$(git rev-parse HEAD) && git cvsexportcommit -w "$CVSWORK" -c $id && echo new > DS && echo new > E/DS && echo modified > release-notes && git add DS E/DS release-notes && git commit -m "Add two files with the same basename" && id=$(git rev-parse HEAD) && git cvsexportcommit -w "$CVSWORK" -c $id && check_entries "$CVSWORK/E" "DS/1.1/|newfile5.txt/1.1/" && check_entries "$CVSWORK" "DS/1.1/|release-notes/1.2/" && test_cmp "$CVSWORK/DS" DS && test_cmp "$CVSWORK/E/DS" E/DS && test_cmp "$CVSWORK/release-notes" release-notes ' test_expect_success 're-commit a removed filename which remains in CVS attic' ' (cd "$CVSWORK" && echo >attic_gremlin && cvs -Q add attic_gremlin && cvs -Q ci -m "added attic_gremlin" && rm attic_gremlin && cvs -Q rm attic_gremlin && cvs -Q ci -m "removed attic_gremlin") && echo > attic_gremlin && git add attic_gremlin && git commit -m "Added attic_gremlin" && git cvsexportcommit -w "$CVSWORK" -c HEAD && (cd "$CVSWORK"; cvs -Q update -d) && test -f "$CVSWORK/attic_gremlin" ' # the state of the CVS sandbox may be indeterminate for ' space' # after this test on some platforms / with some versions of CVS # consider adding new tests above this point test_expect_success 'commit a file with leading spaces in the name' ' echo space > " space" && git add " space" && git commit -m "Add a file with a leading space" && id=$(git rev-parse HEAD) && git cvsexportcommit -w "$CVSWORK" -c $id && check_entries "$CVSWORK" " space/1.1/|DS/1.1/|attic_gremlin/1.3/|release-notes/1.2/" && test_cmp "$CVSWORK/ space" " space" ' test_expect_success 'use the same checkout for Git and CVS' ' (mkdir shared && cd shared && sane_unset GIT_DIR && cvs co . && git init && git add " space" && git commit -m "fake initial commit" && echo Hello >> " space" && git commit -m "Another change" " space" && git cvsexportcommit -W -p -u -c HEAD && grep Hello " space" && git diff-files) ' test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"Test export of commits to CVS">)} spids: [12] ) ] spids: [12] ) (C {(.)} {(./test-lib.sh)}) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children:[(C {(test_have_prereq)} {(PERL)})] negated:True) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:skip_all) op: Equal rhs: {(SQ <"skipping git cvsexportcommit tests, perl not available">)} spids: [35] ) ] spids: [35] ) (C {(test_done)}) ] spids: [-1 32] ) ] spids: [-1 43] ) (SimpleCommand words: [{(cvs)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[48]) (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[51]) ] ) (If arms: [ (if_arm cond: [(C {(test)} {($ VSub_QMark "$?")} {(-ne)} {(1)})] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:skip_all) op: Equal rhs: {(SQ <"skipping git cvsexportcommit tests, cvs not found">)} spids: [67] ) ] spids: [67] ) (C {(test_done)}) ] spids: [-1 64] ) ] spids: [-1 75] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:CVSROOT) op: Equal rhs: {($ VSub_Name "$PWD") (/tmpcvsroot)} spids: [78] ) ] spids: [78] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:CVSWORK) op: Equal rhs: {($ VSub_Name "$PWD") (/cvswork)} spids: [82] ) ] spids: [82] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:GIT_DIR) op: Equal rhs: {($ VSub_Name "$PWD") (/.git)} spids: [86] ) ] spids: [86] ) (C {(export)} {(CVSROOT)} {(CVSWORK)} {(GIT_DIR)}) (C {(rm)} {(-rf)} {(DQ ($ VSub_Name "$CVSROOT"))} {(DQ ($ VSub_Name "$CVSWORK"))}) (AndOr children: [ (C {(cvs)} {(init)}) (AndOr children: [ (C {(test)} {(-d)} {(DQ ($ VSub_Name "$CVSROOT"))}) (AndOr children: [ (C {(cvs)} {(-Q)} {(co)} {(-d)} {(DQ ($ VSub_Name "$CVSWORK"))} {(.)}) (AndOr children: [ (SimpleCommand words: [{(echo)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(empty)} spids:[146])] ) (AndOr children: [ (C {(git)} {(add)} {(empty)}) (AndOr children: [ (SimpleCommand words: [{(git)} {(commit)} {(-q)} {(-a)} {(-m)} {(DQ (Initial))}] redirects: [ (Redir op_id: Redir_Great fd: 2 arg_word: {(/dev/null)} spids: [173] ) ] ) (C {(exit)} {(1)}) ] op_id: Op_DPipe ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) (FuncDef name: check_entries body: (BraceGroup children: [ (Pipeline children: [ (C {(sed)} {(-ne)} {(SQ <"/^\\//p">)} {(DQ ($ VSub_Number "$1") (/CVS/Entries))}) (C {(sort)}) (SimpleCommand words: [{(cut)} {(-d/)} {(-f2) (Lit_Comma ",") (3) (Lit_Comma ",") (5)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(actual)} spids:[224])] ) ] negated: False ) (If arms: [ (if_arm cond: [(C {(test)} {(-z)} {(DQ ($ VSub_Number "$2"))})] action: [ (SimpleCommand redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[242])] ) ] spids: [-1 239] ) ] else_action: [ (Pipeline children: [ (C {(printf)} {(SQ <"%s\\n">)} {(DQ ($ VSub_Number "$2"))}) (SimpleCommand words: [{(tr)} {(SQ <"|">)} {(SQ <"\\012">)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[271])] ) ] negated: False ) ] spids: [246 275] ) (C {(test_cmp)} {(expected)} {(actual)}) ] spids: [188] ) spids: [183 187] ) (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"> <" )"> ) } ) (If arms: [ (if_arm cond: [ (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:p) op: Equal rhs: { (DQ ( "\u00c5/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/\u00e5/\u00e4/\u00f6" ) ) } spids: [543] ) ] spids: [543] ) (AndOr children: [ (C {(mkdir)} {(-p)} {(DQ (tst/) ($ VSub_Name "$p"))}) (AndOr children: [ (SimpleCommand words: [{(date)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ (tst/) ($ VSub_Name "$p") (/day))} spids: [565] ) ] ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:found) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(find)} {(tst)} {(-type)} {(f)} {(-print)})] ) left_token: spids: [576 586] ) } spids: [575] ) ] spids: [575] ) (AndOr children: [ (C {(test)} {(DQ (z) ($ VSub_Name "$found"))} {(Lit_Other "=")} {(DQ (ztst/) ($ VSub_Name "$p") (/day))} ) (C {(rm)} {(-fr)} {(tst)}) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] action: [ (C {(test_expect_success)} {(KW_Bang "!") (MINGW)} {(SQ <"File with non-ascii file name">)} { (SQ < "mkdir -p \u00c5/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/\u00e5/\u00e4/\u00f6 &&\n" > < " echo Foo >\u00c5/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/\u00e5/\u00e4/\u00f6/g\u00e5rdets\u00e5g\u00e5rdet.txt &&\n" > < " git add \u00c5/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/\u00e5/\u00e4/\u00f6/g\u00e5rdets\u00e5g\u00e5rdet.txt &&\n" > < " cp \"$TEST_DIRECTORY\"/test-binary-1.png \u00c5/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/\u00e5/\u00e4/\u00f6/g\u00e5rdets\u00e5g\u00e5rdet.png &&\n" > < " git add \u00c5/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/\u00e5/\u00e4/\u00f6/g\u00e5rdets\u00e5g\u00e5rdet.png &&\n" > <" git commit -a -m \"G\u00e5r det s\u00e5 g\u00e5r det\" && \\\n"> <" id=$(git rev-list --max-count=1 HEAD) &&\n"> <" (cd \"$CVSWORK\" &&\n"> <" git cvsexportcommit -v -c $id &&\n"> <" check_entries \\\n"> < " \"\u00c5/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/\u00e5/\u00e4/\u00f6\" \\\n" > <" \"g\u00e5rdets\u00e5g\u00e5rdet.png/1.1/-kb|g\u00e5rdets\u00e5g\u00e5rdet.txt/1.1/\"\n"> <" )"> ) } ) ] spids: [-1 615] ) ] spids: [-1 651] ) (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)}) ] )