#!/bin/sh # # Copyright (c) 2008 Matthew Ogilvie # Parts adapted from other tests. # global test_description := ''git-cvsserver -kb modes tests -kb mode for binary files when accessing a git repository using cvs CLI client via git-cvsserver server'' source ./test-lib.sh proc marked_as { global foundEntry := $[grep "^/$2/" "$1/CVS/Entries] if test x"$foundEntry" = x"" { echo "NOT FOUND: $1 $2 1 $3" >> "$(WORKDIR)/marked.log" return 1 } test x"$[grep "^/$2/" "$1/CVS/Entries" | cut -d/ -f5]" = x"$3" global stat := $Status echo "$1 $2 $stat '$3'" >> "$(WORKDIR)/marked.log" return $stat } proc not_present { global foundEntry := $[grep "^/$2/" "$1/CVS/Entries] if test -r "$1/$2" { echo "Error: File still exists: $1 $2" >> "$(WORKDIR)/marked.log" return 1; } if test x"$foundEntry" != x"" { echo "Error: should not have found: $1 $2" >> "$(WORKDIR)/marked.log" return 1; } else { echo "Correctly not found: $1 $2" >> "$(WORKDIR)/marked.log" return 0; } } proc check_status_options { shell {cd $1 && env GIT_CONFIG=$git_config cvs -Q status $2 > "$(WORKDIR)/status.out" !2 > !1 } if test x"$Status" != x"0" { echo "Error from cvs status: $1 $2" >> "$(WORKDIR)/marked.log" return 1; } global got := $[sed -n -e 's/^[ ]*Sticky Options:[ ]*//p' "$(WORKDIR)/status.out] global expect := $3 if test x"$expect" = x"" { global expect := '"(none)'" } test x"$got" = x"$expect" global stat := $Status echo "cvs status: $1 $2 $stat '$3' '$got'" >> "$(WORKDIR)/marked.log" return $stat } cvs >/dev/null !2 > !1 if test $Status -ne 1 { global skip_all := ''skipping git-cvsserver tests, cvs not found'' test_done } if ! test_have_prereq PERL { global skip_all := ''skipping git-cvsserver tests, perl not available'' test_done } perl -e 'use DBI; use DBD::SQLite' >/dev/null !2 > !1 || do { global skip_all := ''skipping git-cvsserver tests, Perl SQLite interface unavailable'' test_done } unset GIT_DIR GIT_CONFIG global WORKDIR := $PWD global SERVERDIR := "$PWD/gitcvs.git" global git_config := ""$SERVERDIR/config"" global CVSROOT := "":fork:$SERVERDIR"" global CVSWORK := ""$PWD/cvswork"" global CVS_SERVER := 'git-cvsserver' export CVSROOT CVS_SERVER rm -rf $CVSWORK $SERVERDIR test_expect_success 'setup' ' git config push.default matching && echo "Simple text file" >textfile.c && echo "File with embedded NUL: Q <- there" | q_to_nul > binfile.bin && mkdir subdir && echo "Another text file" > subdir/file.h && echo "Another binary: Q (this time CR)" | q_to_cr > subdir/withCr.bin && echo "Mixed up NUL, but marked text: Q <- there" | q_to_nul > mixedUp.c && echo "Unspecified" > subdir/unspecified.other && echo "/*.bin -crlf" > .gitattributes && echo "/*.c crlf" >> .gitattributes && echo "subdir/*.bin -crlf" >> .gitattributes && echo "subdir/*.c crlf" >> .gitattributes && echo "subdir/file.h crlf" >> .gitattributes && git add .gitattributes textfile.c binfile.bin mixedUp.c subdir/* && git commit -q -m "First Commit" && git clone -q --bare "$WORKDIR/.git" "$SERVERDIR" >/dev/null 2>&1 && GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true && GIT_DIR="$SERVERDIR" git config gitcvs.logfile "$SERVERDIR/gitcvs.log" ' test_expect_success 'cvs co (default crlf)' ' GIT_CONFIG="$git_config" cvs -Q co -d cvswork master >cvs.log 2>&1 && test x"$(grep '/-k' cvswork/CVS/Entries cvswork/subdir/CVS/Entries)" = x"" ' rm -rf cvswork test_expect_success 'cvs co (allbinary)' ' GIT_DIR="$SERVERDIR" git config --bool gitcvs.allbinary true && GIT_CONFIG="$git_config" cvs -Q co -d cvswork master >cvs.log 2>&1 && marked_as cvswork textfile.c -kb && marked_as cvswork binfile.bin -kb && marked_as cvswork .gitattributes -kb && marked_as cvswork mixedUp.c -kb && marked_as cvswork/subdir withCr.bin -kb && marked_as cvswork/subdir file.h -kb && marked_as cvswork/subdir unspecified.other -kb ' rm -rf cvswork cvs.log test_expect_success 'cvs co (use attributes/allbinary)' ' GIT_DIR="$SERVERDIR" git config --bool gitcvs.usecrlfattr true && GIT_CONFIG="$git_config" cvs -Q co -d cvswork master >cvs.log 2>&1 && marked_as cvswork textfile.c "" && marked_as cvswork binfile.bin -kb && marked_as cvswork .gitattributes -kb && marked_as cvswork mixedUp.c "" && marked_as cvswork/subdir withCr.bin -kb && marked_as cvswork/subdir file.h "" && marked_as cvswork/subdir unspecified.other -kb ' rm -rf cvswork test_expect_success 'cvs co (use attributes)' ' GIT_DIR="$SERVERDIR" git config --bool gitcvs.allbinary false && GIT_CONFIG="$git_config" cvs -Q co -d cvswork master >cvs.log 2>&1 && marked_as cvswork textfile.c "" && marked_as cvswork binfile.bin -kb && marked_as cvswork .gitattributes "" && marked_as cvswork mixedUp.c "" && marked_as cvswork/subdir withCr.bin -kb && marked_as cvswork/subdir file.h "" && marked_as cvswork/subdir unspecified.other "" ' test_expect_success 'adding files' ' (cd cvswork && (cd subdir && echo "more text" > src.c && GIT_CONFIG="$git_config" cvs -Q add src.c >cvs.log 2>&1 && marked_as . src.c "" && echo "pseudo-binary" > temp.bin ) && GIT_CONFIG="$git_config" cvs -Q add subdir/temp.bin >cvs.log 2>&1 && marked_as subdir temp.bin "-kb" && cd subdir && GIT_CONFIG="$git_config" cvs -Q ci -m "adding files" >cvs.log 2>&1 && marked_as . temp.bin "-kb" && marked_as . src.c "" ) ' test_expect_success 'updating' ' git pull gitcvs.git && echo 'hi' > subdir/newfile.bin && echo 'junk' > subdir/file.h && echo 'hi' > subdir/newfile.c && echo 'hello' >> binfile.bin && git add subdir/newfile.bin subdir/file.h subdir/newfile.c binfile.bin && git commit -q -m "Add and change some files" && git push gitcvs.git >/dev/null && (cd cvswork && GIT_CONFIG="$git_config" cvs -Q update ) && marked_as cvswork textfile.c "" && marked_as cvswork binfile.bin -kb && marked_as cvswork .gitattributes "" && marked_as cvswork mixedUp.c "" && marked_as cvswork/subdir withCr.bin -kb && marked_as cvswork/subdir file.h "" && marked_as cvswork/subdir unspecified.other "" && marked_as cvswork/subdir newfile.bin -kb && marked_as cvswork/subdir newfile.c "" && echo "File with embedded NUL: Q <- there" | q_to_nul > tmpExpect1 && echo "hello" >> tmpExpect1 && cmp cvswork/binfile.bin tmpExpect1 ' rm -rf cvswork test_expect_success 'cvs co (use attributes/guess)' ' GIT_DIR="$SERVERDIR" git config gitcvs.allbinary guess && GIT_CONFIG="$git_config" cvs -Q co -d cvswork master >cvs.log 2>&1 && marked_as cvswork textfile.c "" && marked_as cvswork binfile.bin -kb && marked_as cvswork .gitattributes "" && marked_as cvswork mixedUp.c "" && marked_as cvswork/subdir withCr.bin -kb && marked_as cvswork/subdir file.h "" && marked_as cvswork/subdir unspecified.other "" && marked_as cvswork/subdir newfile.bin -kb && marked_as cvswork/subdir newfile.c "" ' test_expect_success 'setup multi-line files' ' ( echo "line 1" && echo "line 2" && echo "line 3" && echo "line 4 with NUL: Q <-" ) | q_to_nul > multiline.c && git add multiline.c && ( echo "line 1" && echo "line 2" && echo "line 3" && echo "line 4" ) | q_to_nul > multilineTxt.c && git add multilineTxt.c && git commit -q -m "multiline files" && git push gitcvs.git >/dev/null ' rm -rf cvswork test_expect_success 'cvs co (guess)' ' GIT_DIR="$SERVERDIR" git config --bool gitcvs.usecrlfattr false && GIT_CONFIG="$git_config" cvs -Q co -d cvswork master >cvs.log 2>&1 && marked_as cvswork textfile.c "" && marked_as cvswork binfile.bin -kb && marked_as cvswork .gitattributes "" && marked_as cvswork mixedUp.c -kb && marked_as cvswork multiline.c -kb && marked_as cvswork multilineTxt.c "" && marked_as cvswork/subdir withCr.bin -kb && marked_as cvswork/subdir file.h "" && marked_as cvswork/subdir unspecified.other "" && marked_as cvswork/subdir newfile.bin "" && marked_as cvswork/subdir newfile.c "" ' test_expect_success 'cvs co another copy (guess)' ' GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 && marked_as cvswork2 textfile.c "" && marked_as cvswork2 binfile.bin -kb && marked_as cvswork2 .gitattributes "" && marked_as cvswork2 mixedUp.c -kb && marked_as cvswork2 multiline.c -kb && marked_as cvswork2 multilineTxt.c "" && marked_as cvswork2/subdir withCr.bin -kb && marked_as cvswork2/subdir file.h "" && marked_as cvswork2/subdir unspecified.other "" && marked_as cvswork2/subdir newfile.bin "" && marked_as cvswork2/subdir newfile.c "" ' test_expect_success 'cvs status - sticky options' ' check_status_options cvswork2 textfile.c "" && check_status_options cvswork2 binfile.bin -kb && check_status_options cvswork2 .gitattributes "" && check_status_options cvswork2 mixedUp.c -kb && check_status_options cvswork2 multiline.c -kb && check_status_options cvswork2 multilineTxt.c "" && check_status_options cvswork2/subdir withCr.bin -kb && check_status_options cvswork2 subdir/withCr.bin -kb && check_status_options cvswork2/subdir file.h "" && check_status_options cvswork2 subdir/file.h "" && check_status_options cvswork2/subdir unspecified.other "" && check_status_options cvswork2/subdir newfile.bin "" && check_status_options cvswork2/subdir newfile.c "" ' test_expect_success 'add text (guess)' ' (cd cvswork && echo "simpleText" > simpleText.c && GIT_CONFIG="$git_config" cvs -Q add simpleText.c ) && marked_as cvswork simpleText.c "" ' test_expect_success 'add bin (guess)' ' (cd cvswork && echo "simpleBin: NUL: Q <- there" | q_to_nul > simpleBin.bin && GIT_CONFIG="$git_config" cvs -Q add simpleBin.bin ) && marked_as cvswork simpleBin.bin -kb ' test_expect_success 'remove files (guess)' ' (cd cvswork && GIT_CONFIG="$git_config" cvs -Q rm -f subdir/file.h && (cd subdir && GIT_CONFIG="$git_config" cvs -Q rm -f withCr.bin )) && marked_as cvswork/subdir withCr.bin -kb && marked_as cvswork/subdir file.h "" ' test_expect_success 'cvs ci (guess)' ' (cd cvswork && GIT_CONFIG="$git_config" cvs -Q ci -m "add/rm files" >cvs.log 2>&1 ) && marked_as cvswork textfile.c "" && marked_as cvswork binfile.bin -kb && marked_as cvswork .gitattributes "" && marked_as cvswork mixedUp.c -kb && marked_as cvswork multiline.c -kb && marked_as cvswork multilineTxt.c "" && not_present cvswork/subdir withCr.bin && not_present cvswork/subdir file.h && marked_as cvswork/subdir unspecified.other "" && marked_as cvswork/subdir newfile.bin "" && marked_as cvswork/subdir newfile.c "" && marked_as cvswork simpleBin.bin -kb && marked_as cvswork simpleText.c "" ' test_expect_success 'update subdir of other copy (guess)' ' (cd cvswork2/subdir && GIT_CONFIG="$git_config" cvs -Q update ) && marked_as cvswork2 textfile.c "" && marked_as cvswork2 binfile.bin -kb && marked_as cvswork2 .gitattributes "" && marked_as cvswork2 mixedUp.c -kb && marked_as cvswork2 multiline.c -kb && marked_as cvswork2 multilineTxt.c "" && not_present cvswork2/subdir withCr.bin && not_present cvswork2/subdir file.h && marked_as cvswork2/subdir unspecified.other "" && marked_as cvswork2/subdir newfile.bin "" && marked_as cvswork2/subdir newfile.c "" && not_present cvswork2 simpleBin.bin && not_present cvswork2 simpleText.c ' echo "starting update/merge" >> "$(WORKDIR)/marked.log" test_expect_success 'update/merge full other copy (guess)' ' git pull gitcvs.git master && sed "s/3/replaced_3/" < multilineTxt.c > ml.temp && mv ml.temp multilineTxt.c && git add multilineTxt.c && git commit -q -m "modify multiline file" >> "${WORKDIR}/marked.log" && git push gitcvs.git >/dev/null && (cd cvswork2 && sed "s/1/replaced_1/" < multilineTxt.c > ml.temp && mv ml.temp multilineTxt.c && GIT_CONFIG="$git_config" cvs update > cvs.log 2>&1 ) && marked_as cvswork2 textfile.c "" && marked_as cvswork2 binfile.bin -kb && marked_as cvswork2 .gitattributes "" && marked_as cvswork2 mixedUp.c -kb && marked_as cvswork2 multiline.c -kb && marked_as cvswork2 multilineTxt.c "" && not_present cvswork2/subdir withCr.bin && not_present cvswork2/subdir file.h && marked_as cvswork2/subdir unspecified.other "" && marked_as cvswork2/subdir newfile.bin "" && marked_as cvswork2/subdir newfile.c "" && marked_as cvswork2 simpleBin.bin -kb && marked_as cvswork2 simpleText.c "" && echo "line replaced_1" > tmpExpect2 && echo "line 2" >> tmpExpect2 && echo "line replaced_3" >> tmpExpect2 && echo "line 4" | q_to_nul >> tmpExpect2 && cmp cvswork2/multilineTxt.c tmpExpect2 ' test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: { (SQ <"git-cvsserver -kb modes\n"> <"\n"> <"tests -kb mode for binary files when accessing a git\n"> <"repository using cvs CLI client via git-cvsserver server"> ) } spids: [16] ) ] spids: [16] ) (C {(.)} {(./test-lib.sh)}) (FuncDef name: marked_as body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:foundEntry) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(grep)} {(DQ ("^/") ($ VSub_Number "$2") (/))} {(DQ ($ VSub_Number "$1") (/CVS/Entries))} ) ] ) left_token: spids: [40 53] ) ) } spids: [38] ) ] spids: [38] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(x) (DQ ($ VSub_Name "$foundEntry"))} {(Lit_Other "=")} {(x) (DQ )} {(Lit_Other "]")} ) terminator: ) ] action: [ (SimpleCommand words: [ {(echo)} { (DQ ("NOT FOUND: ") ($ VSub_Number "$1") (" ") ($ VSub_Number "$2") (" 1 ") ($ VSub_Number "$3") ) } ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(DQ (${ VSub_Name WORKDIR) (/marked.log))} spids: [90] ) ] ) (ControlFlow token: arg_word:{(1)}) ] spids: [-1 76] ) ] spids: [-1 105] ) (C {(test)} {(x) (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(grep)} {(DQ ("^/") ($ VSub_Number "$2") (/))} {(DQ ($ VSub_Number "$1") (/CVS/Entries))} ) (C {(cut)} {(-d/)} {(-f5)}) ] negated: False ) ] ) left_token: spids: [112 133] ) ) } {(Lit_Other "=")} {(x) (DQ ($ VSub_Number "$3"))} ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:stat) op: Equal rhs: {($ VSub_QMark "$?")} spids: [144] ) ] spids: [144] ) (SimpleCommand words: [ {(echo)} { (DQ ($ VSub_Number "$1") (" ") ($ VSub_Number "$2") (" ") ($ VSub_Name "$stat") (" '") ($ VSub_Number "$3") ("'") ) } ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(DQ (${ VSub_Name WORKDIR) (/marked.log))} spids: [161] ) ] ) (ControlFlow token: arg_word: {($ VSub_Name "$stat")} ) ] spids: [35] ) spids: [30 34] ) (FuncDef name: not_present body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:foundEntry) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(grep)} {(DQ ("^/") ($ VSub_Number "$2") (/))} {(DQ ($ VSub_Number "$1") (/CVS/Entries))} ) ] ) left_token: spids: [187 200] ) ) } spids: [185] ) ] spids: [185] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-r)} {(DQ ($ VSub_Number "$1") (/) ($ VSub_Number "$2"))} {(Lit_Other "]")} ) terminator: ) ] action: [ (SimpleCommand words: [ {(echo)} { (DQ ("Error: File still exists: ") ($ VSub_Number "$1") (" ") ($ VSub_Number "$2") ) } ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(DQ (${ VSub_Name WORKDIR) (/marked.log))} spids: [232] ) ] ) (Sentence child: (ControlFlow token: arg_word:{(1)}) terminator: ) ] spids: [-1 220] ) ] spids: [-1 248] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(x) (DQ ($ VSub_Name "$foundEntry"))} {(KW_Bang "!") (Lit_Other "=")} {(x) (DQ )} {(Lit_Other "]")} ) terminator: ) ] action: [ (SimpleCommand words: [ {(echo)} { (DQ ("Error: should not have found: ") ($ VSub_Number "$1") (" ") ($ VSub_Number "$2") ) } ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(DQ (${ VSub_Name WORKDIR) (/marked.log))} spids: [283] ) ] ) (Sentence child: (ControlFlow token: arg_word:{(1)}) terminator: ) ] spids: [-1 271] ) ] else_action: [ (SimpleCommand words: [ {(echo)} {(DQ ("Correctly not found: ") ($ VSub_Number "$1") (" ") ($ VSub_Number "$2"))} ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(DQ (${ VSub_Name WORKDIR) (/marked.log))} spids: [311] ) ] ) (Sentence child: (ControlFlow token: arg_word:{(0)}) terminator: ) ] spids: [299 327] ) ] spids: [182] ) spids: [178 181] ) (FuncDef name: check_status_options body: (BraceGroup children: [ (Subshell child: (AndOr children: [ (C {(cd)} {(DQ ($ VSub_Number "$1"))}) (SimpleCommand words: [{(cvs)} {(-Q)} {(status)} {(DQ ($ VSub_Number "$2"))}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ (${ VSub_Name WORKDIR) (/status.out))} spids: [364] ) (Redir op_id: Redir_GreatAnd fd: 2 arg_word: {(1)} spids: [373] ) ] more_env: [ (env_pair name: GIT_CONFIG val: {(DQ ($ VSub_Name "$git_config"))} spids: [349] ) ] ) ] op_id: Op_DAmp ) spids: [339 377] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(x) (DQ ($ VSub_QMark "$?"))} {(KW_Bang "!") (Lit_Other "=")} {(x) (DQ (0))} {(Lit_Other "]")} ) terminator: ) ] action: [ (SimpleCommand words: [ {(echo)} { (DQ ("Error from cvs status: ") ($ VSub_Number "$1") (" ") ($ VSub_Number "$2") ) } ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(DQ (${ VSub_Name WORKDIR) (/marked.log))} spids: [413] ) ] ) (Sentence child: (ControlFlow token: arg_word:{(1)}) terminator: ) ] spids: [-1 401] ) ] spids: [-1 429] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:got) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(sed)} {(-n)} {(-e)} {(SQ <"s/^[ \t]*Sticky Options:[ \t]*//p">)} {(DQ (${ VSub_Name WORKDIR) (/status.out))} ) ] ) left_token: spids: [434 451] ) ) } spids: [432] ) ] spids: [432] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:expect) op: Equal rhs: {(DQ ($ VSub_Number "$3"))} spids: [455] ) ] spids: [455] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(x) (DQ ($ VSub_Name "$expect"))} {(Lit_Other "=")} {(x) (DQ )} {(Lit_Other "]")} ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:expect) op: Equal rhs: {(DQ ("(none)"))} spids: [483] ) ] spids: [483] ) ] spids: [-1 480] ) ] spids: [-1 489] ) (C {(test)} {(x) (DQ ($ VSub_Name "$got"))} {(Lit_Other "=")} {(x) (DQ ($ VSub_Name "$expect"))} ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:stat) op: Equal rhs: {($ VSub_QMark "$?")} spids: [507] ) ] spids: [507] ) (SimpleCommand words: [ {(echo)} { (DQ ("cvs status: ") ($ VSub_Number "$1") (" ") ($ VSub_Number "$2") (" ") ($ VSub_Name "$stat") (" '") ($ VSub_Number "$3") ("' '") ($ VSub_Name "$got") ("'") ) } ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(DQ (${ VSub_Name WORKDIR) (/marked.log))} spids: [527] ) ] ) (ControlFlow token: arg_word: {($ VSub_Name "$stat")} ) ] spids: [336] ) spids: [332 335] ) (SimpleCommand words: [{(cvs)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[546]) (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[549]) ] ) (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-cvsserver tests, cvs not found">)} spids: [565] ) ] spids: [565] ) (C {(test_done)}) ] spids: [-1 562] ) ] spids: [-1 573] ) (If arms: [ (if_arm cond: [(Pipeline children:[(C {(test_have_prereq)} {(PERL)})] negated:True)] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:skip_all) op: Equal rhs: {(SQ <"skipping git-cvsserver tests, perl not available">)} spids: [586] ) ] spids: [586] ) (C {(test_done)}) ] spids: [-1 583] ) ] spids: [-1 594] ) (AndOr children: [ (SimpleCommand words: [{(perl)} {(-e)} {(SQ <"use DBI; use DBD::SQLite">)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[604]) (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[607]) ] ) (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:skip_all) op: Equal rhs: {(SQ <"skipping git-cvsserver tests, Perl SQLite interface unavailable">)} spids: [615] ) ] spids: [615] ) (C {(test_done)}) ] spids: [612] ) ] op_id: Op_DPipe ) (C {(unset)} {(GIT_DIR)} {(GIT_CONFIG)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:WORKDIR) op: Equal rhs: {($ VSub_Name "$PWD")} spids: [632] ) ] spids: [632] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:SERVERDIR) op: Equal rhs: {($ VSub_Name "$PWD") (/gitcvs.git)} spids: [635] ) ] spids: [635] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:git_config) op: Equal rhs: {(DQ ($ VSub_Name "$SERVERDIR") (/config))} spids: [639] ) ] spids: [639] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:CVSROOT) op: Equal rhs: {(DQ (":fork:") ($ VSub_Name "$SERVERDIR"))} spids: [645] ) ] spids: [645] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:CVSWORK) op: Equal rhs: {(DQ ($ VSub_Name "$PWD") (/cvswork))} spids: [651] ) ] spids: [651] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:CVS_SERVER) op:Equal rhs:{(git-cvsserver)} spids:[657])] spids: [657] ) (C {(export)} {(CVSROOT)} {(CVS_SERVER)}) (C {(rm)} {(-rf)} {(DQ ($ VSub_Name "$CVSWORK"))} {(DQ ($ VSub_Name "$SERVERDIR"))}) (C {(test_expect_success)} {(SQ )} { (SQ <"\n"> <" git config push.default matching &&\n"> <" echo \"Simple text file\" >textfile.c &&\n"> <" echo \"File with embedded NUL: Q <- there\" | q_to_nul > binfile.bin &&\n"> <" mkdir subdir &&\n"> <" echo \"Another text file\" > subdir/file.h &&\n"> <" echo \"Another binary: Q (this time CR)\" | q_to_cr > subdir/withCr.bin &&\n"> <" echo \"Mixed up NUL, but marked text: Q <- there\" | q_to_nul > mixedUp.c &&\n"> <" echo \"Unspecified\" > subdir/unspecified.other &&\n"> <" echo \"/*.bin -crlf\" > .gitattributes &&\n"> <" echo \"/*.c crlf\" >> .gitattributes &&\n"> <" echo \"subdir/*.bin -crlf\" >> .gitattributes &&\n"> <" echo \"subdir/*.c crlf\" >> .gitattributes &&\n"> <" echo \"subdir/file.h crlf\" >> .gitattributes &&\n"> <" git add .gitattributes textfile.c binfile.bin mixedUp.c subdir/* &&\n"> <" git commit -q -m \"First Commit\" &&\n"> <" git clone -q --bare \"$WORKDIR/.git\" \"$SERVERDIR\" >/dev/null 2>&1 &&\n"> <" GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.enabled true &&\n"> <" GIT_DIR=\"$SERVERDIR\" git config gitcvs.logfile \"$SERVERDIR/gitcvs.log\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"cvs co (default crlf)">)} { (SQ <"\n"> <" GIT_CONFIG=\"$git_config\" cvs -Q co -d cvswork master >cvs.log 2>&1 &&\n"> <" test x\"$(grep "> ) (/-k) (SQ <" cvswork/CVS/Entries cvswork/subdir/CVS/Entries)\" = x\"\"\n">) } ) (C {(rm)} {(-rf)} {(cvswork)}) (C {(test_expect_success)} {(SQ <"cvs co (allbinary)">)} { (SQ <"\n"> <" GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.allbinary true &&\n"> <" GIT_CONFIG=\"$git_config\" cvs -Q co -d cvswork master >cvs.log 2>&1 &&\n"> <" marked_as cvswork textfile.c -kb &&\n"> <" marked_as cvswork binfile.bin -kb &&\n"> <" marked_as cvswork .gitattributes -kb &&\n"> <" marked_as cvswork mixedUp.c -kb &&\n"> <" marked_as cvswork/subdir withCr.bin -kb &&\n"> <" marked_as cvswork/subdir file.h -kb &&\n"> <" marked_as cvswork/subdir unspecified.other -kb\n"> ) } ) (C {(rm)} {(-rf)} {(cvswork)} {(cvs.log)}) (C {(test_expect_success)} {(SQ <"cvs co (use attributes/allbinary)">)} { (SQ <"\n"> <" GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.usecrlfattr true &&\n"> <" GIT_CONFIG=\"$git_config\" cvs -Q co -d cvswork master >cvs.log 2>&1 &&\n"> <" marked_as cvswork textfile.c \"\" &&\n"> <" marked_as cvswork binfile.bin -kb &&\n"> <" marked_as cvswork .gitattributes -kb &&\n"> <" marked_as cvswork mixedUp.c \"\" &&\n"> <" marked_as cvswork/subdir withCr.bin -kb &&\n"> <" marked_as cvswork/subdir file.h \"\" &&\n"> <" marked_as cvswork/subdir unspecified.other -kb\n"> ) } ) (C {(rm)} {(-rf)} {(cvswork)}) (C {(test_expect_success)} {(SQ <"cvs co (use attributes)">)} { (SQ <"\n"> <" GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.allbinary false &&\n"> <" GIT_CONFIG=\"$git_config\" cvs -Q co -d cvswork master >cvs.log 2>&1 &&\n"> <" marked_as cvswork textfile.c \"\" &&\n"> <" marked_as cvswork binfile.bin -kb &&\n"> <" marked_as cvswork .gitattributes \"\" &&\n"> <" marked_as cvswork mixedUp.c \"\" &&\n"> <" marked_as cvswork/subdir withCr.bin -kb &&\n"> <" marked_as cvswork/subdir file.h \"\" &&\n"> <" marked_as cvswork/subdir unspecified.other \"\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"adding files">)} { (SQ <"\n"> <" (cd cvswork &&\n"> <" (cd subdir &&\n"> <" echo \"more text\" > src.c &&\n"> <" GIT_CONFIG=\"$git_config\" cvs -Q add src.c >cvs.log 2>&1 &&\n"> <" marked_as . src.c \"\" &&\n"> <" echo \"pseudo-binary\" > temp.bin\n"> <" ) &&\n"> <" GIT_CONFIG=\"$git_config\" cvs -Q add subdir/temp.bin >cvs.log 2>&1 &&\n"> <" marked_as subdir temp.bin \"-kb\" &&\n"> <" cd subdir &&\n"> <" GIT_CONFIG=\"$git_config\" cvs -Q ci -m \"adding files\" >cvs.log 2>&1 &&\n"> <" marked_as . temp.bin \"-kb\" &&\n"> <" marked_as . src.c \"\"\n"> <" )\n"> ) } ) (C {(test_expect_success)} {(SQ )} {(SQ <"\n"> <" git pull gitcvs.git &&\n"> <" echo ">) (hi) (SQ <" > subdir/newfile.bin &&\n"> <" echo ">) (junk) (SQ <" > subdir/file.h &&\n"> <" echo ">) (hi) (SQ <" > subdir/newfile.c &&\n"> <" echo ">) (hello) (SQ <" >> binfile.bin &&\n"> <" git add subdir/newfile.bin subdir/file.h subdir/newfile.c binfile.bin &&\n"> <" git commit -q -m \"Add and change some files\" &&\n"> <" git push gitcvs.git >/dev/null &&\n"> <" (cd cvswork &&\n"> <" GIT_CONFIG=\"$git_config\" cvs -Q update\n"> <" ) &&\n"> <" marked_as cvswork textfile.c \"\" &&\n"> <" marked_as cvswork binfile.bin -kb &&\n"> <" marked_as cvswork .gitattributes \"\" &&\n"> <" marked_as cvswork mixedUp.c \"\" &&\n"> <" marked_as cvswork/subdir withCr.bin -kb &&\n"> <" marked_as cvswork/subdir file.h \"\" &&\n"> <" marked_as cvswork/subdir unspecified.other \"\" &&\n"> <" marked_as cvswork/subdir newfile.bin -kb &&\n"> <" marked_as cvswork/subdir newfile.c \"\" &&\n"> <" echo \"File with embedded NUL: Q <- there\" | q_to_nul > tmpExpect1 &&\n"> <" echo \"hello\" >> tmpExpect1 &&\n"> <" cmp cvswork/binfile.bin tmpExpect1\n"> ) } ) (C {(rm)} {(-rf)} {(cvswork)}) (C {(test_expect_success)} {(SQ <"cvs co (use attributes/guess)">)} { (SQ <"\n"> <" GIT_DIR=\"$SERVERDIR\" git config gitcvs.allbinary guess &&\n"> <" GIT_CONFIG=\"$git_config\" cvs -Q co -d cvswork master >cvs.log 2>&1 &&\n"> <" marked_as cvswork textfile.c \"\" &&\n"> <" marked_as cvswork binfile.bin -kb &&\n"> <" marked_as cvswork .gitattributes \"\" &&\n"> <" marked_as cvswork mixedUp.c \"\" &&\n"> <" marked_as cvswork/subdir withCr.bin -kb &&\n"> <" marked_as cvswork/subdir file.h \"\" &&\n"> <" marked_as cvswork/subdir unspecified.other \"\" &&\n"> <" marked_as cvswork/subdir newfile.bin -kb &&\n"> <" marked_as cvswork/subdir newfile.c \"\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"setup multi-line files">)} { (SQ <"\n"> <" ( echo \"line 1\" &&\n"> <" echo \"line 2\" &&\n"> <" echo \"line 3\" &&\n"> <" echo \"line 4 with NUL: Q <-\" ) | q_to_nul > multiline.c &&\n"> <" git add multiline.c &&\n"> <" ( echo \"line 1\" &&\n"> <" echo \"line 2\" &&\n"> <" echo \"line 3\" &&\n"> <" echo \"line 4\" ) | q_to_nul > multilineTxt.c &&\n"> <" git add multilineTxt.c &&\n"> <" git commit -q -m \"multiline files\" &&\n"> <" git push gitcvs.git >/dev/null\n"> ) } ) (C {(rm)} {(-rf)} {(cvswork)}) (C {(test_expect_success)} {(SQ <"cvs co (guess)">)} { (SQ <"\n"> <" GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.usecrlfattr false &&\n"> <" GIT_CONFIG=\"$git_config\" cvs -Q co -d cvswork master >cvs.log 2>&1 &&\n"> <" marked_as cvswork textfile.c \"\" &&\n"> <" marked_as cvswork binfile.bin -kb &&\n"> <" marked_as cvswork .gitattributes \"\" &&\n"> <" marked_as cvswork mixedUp.c -kb &&\n"> <" marked_as cvswork multiline.c -kb &&\n"> <" marked_as cvswork multilineTxt.c \"\" &&\n"> <" marked_as cvswork/subdir withCr.bin -kb &&\n"> <" marked_as cvswork/subdir file.h \"\" &&\n"> <" marked_as cvswork/subdir unspecified.other \"\" &&\n"> <" marked_as cvswork/subdir newfile.bin \"\" &&\n"> <" marked_as cvswork/subdir newfile.c \"\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"cvs co another copy (guess)">)} { (SQ <"\n"> <" GIT_CONFIG=\"$git_config\" cvs -Q co -d cvswork2 master >cvs.log 2>&1 &&\n"> <" marked_as cvswork2 textfile.c \"\" &&\n"> <" marked_as cvswork2 binfile.bin -kb &&\n"> <" marked_as cvswork2 .gitattributes \"\" &&\n"> <" marked_as cvswork2 mixedUp.c -kb &&\n"> <" marked_as cvswork2 multiline.c -kb &&\n"> <" marked_as cvswork2 multilineTxt.c \"\" &&\n"> <" marked_as cvswork2/subdir withCr.bin -kb &&\n"> <" marked_as cvswork2/subdir file.h \"\" &&\n"> <" marked_as cvswork2/subdir unspecified.other \"\" &&\n"> <" marked_as cvswork2/subdir newfile.bin \"\" &&\n"> <" marked_as cvswork2/subdir newfile.c \"\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"cvs status - sticky options">)} { (SQ <"\n"> <" check_status_options cvswork2 textfile.c \"\" &&\n"> <" check_status_options cvswork2 binfile.bin -kb &&\n"> <" check_status_options cvswork2 .gitattributes \"\" &&\n"> <" check_status_options cvswork2 mixedUp.c -kb &&\n"> <" check_status_options cvswork2 multiline.c -kb &&\n"> <" check_status_options cvswork2 multilineTxt.c \"\" &&\n"> <" check_status_options cvswork2/subdir withCr.bin -kb &&\n"> <" check_status_options cvswork2 subdir/withCr.bin -kb &&\n"> <" check_status_options cvswork2/subdir file.h \"\" &&\n"> <" check_status_options cvswork2 subdir/file.h \"\" &&\n"> <" check_status_options cvswork2/subdir unspecified.other \"\" &&\n"> <" check_status_options cvswork2/subdir newfile.bin \"\" &&\n"> <" check_status_options cvswork2/subdir newfile.c \"\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"add text (guess)">)} { (SQ <"\n"> <" (cd cvswork &&\n"> <" echo \"simpleText\" > simpleText.c &&\n"> <" GIT_CONFIG=\"$git_config\" cvs -Q add simpleText.c\n"> <" ) &&\n"> <" marked_as cvswork simpleText.c \"\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"add bin (guess)">)} { (SQ <"\n"> <" (cd cvswork &&\n"> <" echo \"simpleBin: NUL: Q <- there\" | q_to_nul > simpleBin.bin &&\n"> <" GIT_CONFIG=\"$git_config\" cvs -Q add simpleBin.bin\n"> <" ) &&\n"> <" marked_as cvswork simpleBin.bin -kb\n"> ) } ) (C {(test_expect_success)} {(SQ <"remove files (guess)">)} { (SQ <"\n"> <" (cd cvswork &&\n"> <" GIT_CONFIG=\"$git_config\" cvs -Q rm -f subdir/file.h &&\n"> <" (cd subdir &&\n"> <" GIT_CONFIG=\"$git_config\" cvs -Q rm -f withCr.bin\n"> <" )) &&\n"> <" marked_as cvswork/subdir withCr.bin -kb &&\n"> <" marked_as cvswork/subdir file.h \"\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"cvs ci (guess)">)} { (SQ <"\n"> <" (cd cvswork &&\n"> <" GIT_CONFIG=\"$git_config\" cvs -Q ci -m \"add/rm files\" >cvs.log 2>&1\n"> <" ) &&\n"> <" marked_as cvswork textfile.c \"\" &&\n"> <" marked_as cvswork binfile.bin -kb &&\n"> <" marked_as cvswork .gitattributes \"\" &&\n"> <" marked_as cvswork mixedUp.c -kb &&\n"> <" marked_as cvswork multiline.c -kb &&\n"> <" marked_as cvswork multilineTxt.c \"\" &&\n"> <" not_present cvswork/subdir withCr.bin &&\n"> <" not_present cvswork/subdir file.h &&\n"> <" marked_as cvswork/subdir unspecified.other \"\" &&\n"> <" marked_as cvswork/subdir newfile.bin \"\" &&\n"> <" marked_as cvswork/subdir newfile.c \"\" &&\n"> <" marked_as cvswork simpleBin.bin -kb &&\n"> <" marked_as cvswork simpleText.c \"\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"update subdir of other copy (guess)">)} { (SQ <"\n"> <" (cd cvswork2/subdir &&\n"> <" GIT_CONFIG=\"$git_config\" cvs -Q update\n"> <" ) &&\n"> <" marked_as cvswork2 textfile.c \"\" &&\n"> <" marked_as cvswork2 binfile.bin -kb &&\n"> <" marked_as cvswork2 .gitattributes \"\" &&\n"> <" marked_as cvswork2 mixedUp.c -kb &&\n"> <" marked_as cvswork2 multiline.c -kb &&\n"> <" marked_as cvswork2 multilineTxt.c \"\" &&\n"> <" not_present cvswork2/subdir withCr.bin &&\n"> <" not_present cvswork2/subdir file.h &&\n"> <" marked_as cvswork2/subdir unspecified.other \"\" &&\n"> <" marked_as cvswork2/subdir newfile.bin \"\" &&\n"> <" marked_as cvswork2/subdir newfile.c \"\" &&\n"> <" not_present cvswork2 simpleBin.bin &&\n"> <" not_present cvswork2 simpleText.c\n"> ) } ) (SimpleCommand words: [{(echo)} {(DQ ("starting update/merge"))}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(DQ (${ VSub_Name WORKDIR) (/marked.log))} spids: [1118] ) ] ) (C {(test_expect_success)} {(SQ <"update/merge full other copy (guess)">)} { (SQ <"\n"> <" git pull gitcvs.git master &&\n"> <" sed \"s/3/replaced_3/\" < multilineTxt.c > ml.temp &&\n"> <" mv ml.temp multilineTxt.c &&\n"> <" git add multilineTxt.c &&\n"> <" git commit -q -m \"modify multiline file\" >> \"${WORKDIR}/marked.log\" &&\n"> <" git push gitcvs.git >/dev/null &&\n"> <" (cd cvswork2 &&\n"> <" sed \"s/1/replaced_1/\" < multilineTxt.c > ml.temp &&\n"> <" mv ml.temp multilineTxt.c &&\n"> <" GIT_CONFIG=\"$git_config\" cvs update > cvs.log 2>&1\n"> <" ) &&\n"> <" marked_as cvswork2 textfile.c \"\" &&\n"> <" marked_as cvswork2 binfile.bin -kb &&\n"> <" marked_as cvswork2 .gitattributes \"\" &&\n"> <" marked_as cvswork2 mixedUp.c -kb &&\n"> <" marked_as cvswork2 multiline.c -kb &&\n"> <" marked_as cvswork2 multilineTxt.c \"\" &&\n"> <" not_present cvswork2/subdir withCr.bin &&\n"> <" not_present cvswork2/subdir file.h &&\n"> <" marked_as cvswork2/subdir unspecified.other \"\" &&\n"> <" marked_as cvswork2/subdir newfile.bin \"\" &&\n"> <" marked_as cvswork2/subdir newfile.c \"\" &&\n"> <" marked_as cvswork2 simpleBin.bin -kb &&\n"> <" marked_as cvswork2 simpleText.c \"\" &&\n"> <" echo \"line replaced_1\" > tmpExpect2 &&\n"> <" echo \"line 2\" >> tmpExpect2 &&\n"> <" echo \"line replaced_3\" >> tmpExpect2 &&\n"> <" echo \"line 4\" | q_to_nul >> tmpExpect2 &&\n"> <" cmp cvswork2/multilineTxt.c tmpExpect2\n"> ) } ) (C {(test_done)}) ] )