{"thread":{"id":"32261","subject":"[PATCH] t9402: sed -i is not portable","startedAt":"2012-12-02T12:22:44Z","lastAt":"2012-12-03T16:53:28Z","messageCount":2,"participants":["Torsten Bögershausen","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"204424","messageId":"201212021322.45418.tboegi@web.de","threadId":"32261","inReplyTo":null,"subject":"[PATCH] t9402: sed -i is not portable","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2012-12-02T12:22:44Z","receivedAt":"2012-12-02T12:22:44Z","isPatch":true,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On some systems sed allows the usage of e.g.\nsed -i -e \"s/line1/line2/\" afile\nto edit the file \"in place\".\nOther systems don't allow that: one observed behaviour is that\nsed -i -e \"s/line1/line2/\" afile\ncreates a backup file called afile-e, which breaks the test.\nAs sed -i is not part of POSIX, avoid it.\n\nUse test_cmp, makes the test easier to debug.\nChain all shell commands with && to detect all kinds of failure.\nWhile at it, Use TAB to indent.\n\nSigned-off-by: Torsten Bögershausen <tboegi@web.de>\n---\nNote: this should go on top of pu\n\n t/t9402-git-cvsserver-refs.sh | 764 +++++++++++++++++++++---------------------\n 1 file changed, 383 insertions(+), 381 deletions(-)\n\ndiff --git a/t/t9402-git-cvsserver-refs.sh b/t/t9402-git-cvsserver-refs.sh\nindex 858ef0f..39c6b01 100755\n--- a/t/t9402-git-cvsserver-refs.sh\n+++ b/t/t9402-git-cvsserver-refs.sh\n@@ -10,59 +10,58 @@ tags, branches and other git refspecs'\n #########\n \n check_start_tree() {\n-    rm -f \"$WORKDIR/check.list\"\n-    echo \"start $1\" >> \"${WORKDIR}/check.log\"\n+\t\trm -f \"$WORKDIR/check.list\"\n+\t\techo \"start $1\" >> \"${WORKDIR}/check.log\"\n }\n \n check_file() {\n-    sandbox=\"$1\"\n-    file=\"$2\"\n-    ver=\"$3\"\n-    GIT_DIR=$SERVERDIR git show \"${ver}:${file}\" \\\n+\t\tsandbox=\"$1\"\n+\t\tfile=\"$2\"\n+\t\tver=\"$3\"\n+\t\tGIT_DIR=$SERVERDIR git show \"${ver}:${file}\" \\\n \t> \"$WORKDIR/check.got\" 2> \"$WORKDIR/check.stderr\"\n-    test_cmp \"$WORKDIR/check.got\" \"$sandbox/$file\"\n-    stat=$?\n-    echo \"check_file $sandbox $file $ver : $stat\" >> \"$WORKDIR/check.log\"\n-    echo \"$file\" >> \"$WORKDIR/check.list\"\n-    return $stat\n+\t\ttest_cmp \"$WORKDIR/check.got\" \"$sandbox/$file\"\n+\t\tstat=$?\n+\t\techo \"check_file $sandbox $file $ver : $stat\" >> \"$WORKDIR/check.log\"\n+\t\techo \"$file\" >> \"$WORKDIR/check.list\"\n+\t\treturn $stat\n }\n \n check_end_tree() {\n-    sandbox=\"$1\"\n-    expectCount=$(wc -l < \"$WORKDIR/check.list\")\n-    cvsCount=$(find \"$sandbox\" -name CVS -prune -o -type f -print | wc -l)\n-    test x\"$cvsCount\" = x\"$expectCount\"\n-    stat=$?\n-    echo \"check_end $sandbox : $stat cvs=$cvsCount expect=$expectCount\" \\\n-\t>> \"$WORKDIR/check.log\"\n-    return $stat\n+\t\tsandbox=\"$1\" &&\n+\t\twc -l < \"$WORKDIR/check.list\" > expected &&\n+\t\tfind \"$sandbox\" -type f | grep -v \"/CVS\" > \"$WORKDIR/check.cvsCount\" &&\n+\t\twc -l < \"$WORKDIR/check.cvsCount\" >actual &&\n+\t\ttest_cmp expected actual &&\n+\t\trm expected actual &&\n+\t\tsort < \"$WORKDIR/check.list\" > expected &&\n+\t\tsort < \"$WORKDIR/check.cvsCount\" | sed -e \"s%cvswork/%%\" >actual &&\n+\t\ttest_cmp expected actual &&\n+\t\trm expected actual\n }\n \n check_end_full_tree() {\n-    sandbox=\"$1\"\n-    ver=\"$2\"\n-    expectCount=$(wc -l < \"$WORKDIR/check.list\")\n-    cvsCount=$(find \"$sandbox\" -name CVS -prune -o -type f -print | wc -l)\n-    gitCount=$(git ls-tree -r \"$2\" | wc -l)\n-    test x\"$cvsCount\" = x\"$expectCount\" -a x\"$gitCount\" = x\"$expectCount\"\n-    stat=$?\n-    echo \"check_end $sandbox : $stat cvs=$cvsCount git=$gitCount expect=$expectCount\" \\\n-\t>> \"$WORKDIR/check.log\"\n-    return $stat\n+\t\tsandbox=\"$1\" &&\n+\t\tsort < \"$WORKDIR/check.list\" >expected &&\n+\t\tfind \"$sandbox\" -name CVS -prune -o -type f -print | sed -e \"s%$sandbox/%%\" | sort >act1 &&\n+\t\ttest_cmp expected act1 &&\n+\t\tgit ls-tree -r \"$2\" | sed -e \"s/^.*blob [0-9a-fA-F]*[\t ]*//\" | sort > act2 &&\n+\t\ttest_cmp expected act2 &&\n+\t\trm expected act1 act2\n }\n \n #########\n \n check_diff() {\n-    diffFile=\"$1\"\n-    vOld=\"$2\"\n-    vNew=\"$3\"\n-    rm -rf diffSandbox\n-    git clone -q -n . diffSandbox &&\n-    ( cd diffSandbox &&\n-      git checkout \"$vOld\" &&\n-      git apply -p0 --index <\"../$diffFile\" &&\n-      git diff --exit-code \"$vNew\" ) > check_diff_apply.out 2>&1\n+\t\tdiffFile=\"$1\"\n+\t\tvOld=\"$2\"\n+\t\tvNew=\"$3\"\n+\t\trm -rf diffSandbox\n+\t\tgit clone -q -n . diffSandbox &&\n+\t\t( cd diffSandbox &&\n+\t\t\tgit checkout \"$vOld\" &&\n+\t\t\tgit apply -p0 --index <\"../$diffFile\" &&\n+\t\t\tgit diff --exit-code \"$vNew\" ) > check_diff_apply.out 2>&1\n }\n \n #########\n@@ -70,17 +69,17 @@ check_diff() {\n cvs >/dev/null 2>&1\n if test $? -ne 1\n then\n-    skip_all='skipping git-cvsserver tests, cvs not found'\n-    test_done\n+\t\tskip_all='skipping git-cvsserver tests, cvs not found'\n+\t\ttest_done\n fi\n if ! test_have_prereq PERL\n then\n-    skip_all='skipping git-cvsserver tests, perl not available'\n-    test_done\n+\t\tskip_all='skipping git-cvsserver tests, perl not available'\n+\t\ttest_done\n fi\n \"$PERL_PATH\" -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {\n-    skip_all='skipping git-cvsserver tests, Perl SQLite interface unavailable'\n-    test_done\n+\t\tskip_all='skipping git-cvsserver tests, Perl SQLite interface unavailable'\n+\t\ttest_done\n }\n \n unset GIT_DIR GIT_CONFIG\n@@ -94,465 +93,468 @@ export CVSROOT CVS_SERVER\n \n rm -rf \"$CVSWORK\" \"$SERVERDIR\"\n test_expect_success 'setup v1, b1' '\n-    echo \"Simple text file\" > textfile.c &&\n-    echo \"t2\" > t2 &&\n-    mkdir adir &&\n-    echo \"adir/afile line1\" > adir/afile &&\n-    echo \"adir/afile line2\" >> adir/afile &&\n-    echo \"adir/afile line3\" >> adir/afile &&\n-    echo \"adir/afile line4\" >> adir/afile &&\n-    echo \"adir/a2file\" >> adir/a2file &&\n-    mkdir adir/bdir &&\n-    echo \"adir/bdir/bfile line 1\" > adir/bdir/bfile &&\n-    echo \"adir/bdir/bfile line 2\" >> adir/bdir/bfile &&\n-    echo \"adir/bdir/b2file\" > adir/bdir/b2file &&\n-    git add textfile.c t2 adir &&\n-    git commit -q -m \"First Commit (v1)\" &&\n-    git tag v1 &&\n-    git branch b1 &&\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+\t\techo \"Simple text file\" > textfile.c &&\n+\t\techo \"t2\" > t2 &&\n+\t\tmkdir adir &&\n+\t\techo \"adir/afile line1\" > adir/afile &&\n+\t\techo \"adir/afile line2\" >> adir/afile &&\n+\t\techo \"adir/afile line3\" >> adir/afile &&\n+\t\techo \"adir/afile line4\" >> adir/afile &&\n+\t\techo \"adir/a2file\" >> adir/a2file &&\n+\t\tmkdir adir/bdir &&\n+\t\techo \"adir/bdir/bfile line 1\" > adir/bdir/bfile &&\n+\t\techo \"adir/bdir/bfile line 2\" >> adir/bdir/bfile &&\n+\t\techo \"adir/bdir/b2file\" > adir/bdir/b2file &&\n+\t\tgit add textfile.c t2 adir &&\n+\t\tgit commit -q -m \"First Commit (v1)\" &&\n+\t\tgit tag v1 &&\n+\t\tgit branch b1 &&\n+\t\tgit clone -q --bare \"$WORKDIR/.git\" \"$SERVERDIR\" >/dev/null 2>&1 &&\n+\t\tGIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.enabled true &&\n+\t\tGIT_DIR=\"$SERVERDIR\" git config gitcvs.logfile \"$SERVERDIR/gitcvs.log\"\n '\n \n rm -rf cvswork\n test_expect_success 'cvs co v1' '\n-    cvs -f -Q co -r v1 -d cvswork master >cvs.log 2>&1 &&\n-    check_start_tree cvswork &&\n-    check_file cvswork textfile.c v1 &&\n-    check_file cvswork t2 v1 &&\n-    check_file cvswork adir/afile v1 &&\n-    check_file cvswork adir/a2file v1 &&\n-    check_file cvswork adir/bdir/bfile v1 &&\n-    check_file cvswork adir/bdir/b2file v1 &&\n-    check_end_tree cvswork\n+\t\tcvs -f -Q co -r v1 -d cvswork master >cvs.log 2>&1 &&\n+\t\tcheck_start_tree cvswork &&\n+\t\tcheck_file cvswork textfile.c v1 &&\n+\t\tcheck_file cvswork t2 v1 &&\n+\t\tcheck_file cvswork adir/afile v1 &&\n+\t\tcheck_file cvswork adir/a2file v1 &&\n+\t\tcheck_file cvswork adir/bdir/bfile v1 &&\n+\t\tcheck_file cvswork adir/bdir/b2file v1 &&\n+\t\tcheck_end_tree cvswork\n '\n \n rm -rf cvswork\n test_expect_success 'cvs co b1' '\n-    cvs -f co -r b1 -d cvswork master >cvs.log 2>&1 &&\n-    check_start_tree cvswork &&\n-    check_file cvswork textfile.c v1 &&\n-    check_file cvswork t2 v1 &&\n-    check_file cvswork adir/afile v1 &&\n-    check_file cvswork adir/a2file v1 &&\n-    check_file cvswork adir/bdir/bfile v1 &&\n-    check_file cvswork adir/bdir/b2file v1 &&\n-    check_end_tree cvswork\n+\t\tcvs -f co -r b1 -d cvswork master >cvs.log 2>&1 &&\n+\t\tcheck_start_tree cvswork &&\n+\t\tcheck_file cvswork textfile.c v1 &&\n+\t\tcheck_file cvswork t2 v1 &&\n+\t\tcheck_file cvswork adir/afile v1 &&\n+\t\tcheck_file cvswork adir/a2file v1 &&\n+\t\tcheck_file cvswork adir/bdir/bfile v1 &&\n+\t\tcheck_file cvswork adir/bdir/b2file v1 &&\n+\t\tcheck_end_tree cvswork\n '\n \n test_expect_success 'cvs co b1 [cvswork3]' '\n-    cvs -f co -r b1 -d cvswork3 master >cvs.log 2>&1 &&\n-    check_start_tree cvswork3 &&\n-    check_file cvswork3 textfile.c v1 &&\n-    check_file cvswork3 t2 v1 &&\n-    check_file cvswork3 adir/afile v1 &&\n-    check_file cvswork3 adir/a2file v1 &&\n-    check_file cvswork3 adir/bdir/bfile v1 &&\n-    check_file cvswork3 adir/bdir/b2file v1 &&\n-    check_end_full_tree cvswork3 v1\n+\t\tcvs -f co -r b1 -d cvswork3 master >cvs.log 2>&1 &&\n+\t\tcheck_start_tree cvswork3 &&\n+\t\tcheck_file cvswork3 textfile.c v1 &&\n+\t\tcheck_file cvswork3 t2 v1 &&\n+\t\tcheck_file cvswork3 adir/afile v1 &&\n+\t\tcheck_file cvswork3 adir/a2file v1 &&\n+\t\tcheck_file cvswork3 adir/bdir/bfile v1 &&\n+\t\tcheck_file cvswork3 adir/bdir/b2file v1 &&\n+\t\tcheck_end_full_tree cvswork3 v1\n '\n \n test_expect_success 'edit cvswork3 and save diff' '\n-    ( cd cvswork3 &&\n-      sed -i -e \"s/line1/line1 - data/\" adir/afile &&\n-      echo \"afile5\" > adir/afile5 &&\n-      rm t2 &&\n-      cvs -f add adir/afile5 &&\n-      cvs -f rm t2 &&\n-      test_must_fail cvs -f diff -N -u >\"$WORKDIR/cvswork3edit.diff\"\n-    )\n+\t\t( cd cvswork3 &&\n+\t\t\tsed -e \"s/line1/line1 - data/\" adir/afile >adir/afileNEW &&\n+\t\t\tmv -f adir/afileNEW adir/afile &&\n+\t\t\techo \"afile5\" > adir/afile5 &&\n+\t\t\trm t2 &&\n+\t\t\tcvs -f add adir/afile5 &&\n+\t\t\tcvs -f rm t2 &&\n+\t\t\ttest_must_fail cvs -f diff -N -u >\"$WORKDIR/cvswork3edit.diff\"\n+\t\t)\n '\n \n test_expect_success 'setup v1.2 on b1' '\n-    git checkout b1 &&\n-    echo \"new v1.2\" > t3 &&\n-    rm t2 &&\n-    sed -i -e \"s/line3/line3 - more data/\" adir/afile &&\n-    rm adir/a2file &&\n-    echo \"a3file\" >> adir/a3file &&\n-    echo \"bfile line 3\" >> adir/bdir/bfile &&\n-    rm adir/bdir/b2file &&\n-    echo \"b3file\" > adir/bdir/b3file &&\n-    mkdir cdir &&\n-    echo \"cdir/cfile\" > cdir/cfile &&\n-    git add -A cdir adir t3 t2 &&\n-    git commit -q -m 'v1.2' &&\n-    git tag v1.2 &&\n-    git push --tags gitcvs.git b1:b1\n+\t\tgit checkout b1 &&\n+\t\techo \"new v1.2\" > t3 &&\n+\t\trm t2 &&\n+\t\tsed -e \"s/line3/line3 - more data/\" adir/afile >adir/afileNEW &&\n+\t\tmv -f adir/afileNEW adir/afile &&\n+\t\trm adir/a2file &&\n+\t\techo \"a3file\" >> adir/a3file &&\n+\t\techo \"bfile line 3\" >> adir/bdir/bfile &&\n+\t\trm adir/bdir/b2file &&\n+\t\techo \"b3file\" > adir/bdir/b3file &&\n+\t\tmkdir cdir &&\n+\t\techo \"cdir/cfile\" > cdir/cfile &&\n+\t\tgit add -A cdir adir t3 t2 &&\n+\t\tgit commit -q -m 'v1.2' &&\n+\t\tgit tag v1.2 &&\n+\t\tgit push --tags gitcvs.git b1:b1\n '\n \n test_expect_success 'cvs -f up (on b1 adir)' '\n-    ( cd cvswork/adir &&\n-      cvs -f up -d ) >cvs.log 2>&1 &&\n-    check_start_tree cvswork &&\n-    check_file cvswork textfile.c v1 &&\n-    check_file cvswork t2 v1 &&\n-    check_file cvswork adir/afile v1.2 &&\n-    check_file cvswork adir/a3file v1.2 &&\n-    check_file cvswork adir/bdir/bfile v1.2 &&\n-    check_file cvswork adir/bdir/b3file v1.2 &&\n-    check_end_tree cvswork\n+\t\t( cd cvswork/adir &&\n+\t\t\tcvs -f up -d ) >cvs.log 2>&1 &&\n+\t\tcheck_start_tree cvswork &&\n+\t\tcheck_file cvswork textfile.c v1 &&\n+\t\tcheck_file cvswork t2 v1 &&\n+\t\tcheck_file cvswork adir/afile v1.2 &&\n+\t\tcheck_file cvswork adir/a3file v1.2 &&\n+\t\tcheck_file cvswork adir/bdir/bfile v1.2 &&\n+\t\tcheck_file cvswork adir/bdir/b3file v1.2 &&\n+\t\tcheck_end_tree cvswork\n '\n \n test_expect_success 'cvs up (on b1 /)' '\n-    ( cd cvswork &&\n-      cvs -f up -d ) >cvs.log 2>&1 &&\n-    check_start_tree cvswork &&\n-    check_file cvswork textfile.c v1.2 &&\n-    check_file cvswork t3 v1.2 &&\n-    check_file cvswork adir/afile v1.2 &&\n-    check_file cvswork adir/a3file v1.2 &&\n-    check_file cvswork adir/bdir/bfile v1.2 &&\n-    check_file cvswork adir/bdir/b3file v1.2 &&\n-    check_file cvswork cdir/cfile v1.2 &&\n-    check_end_tree cvswork\n+\t\t( cd cvswork &&\n+\t\t\tcvs -f up -d ) >cvs.log 2>&1 &&\n+\t\tcheck_start_tree cvswork &&\n+\t\tcheck_file cvswork textfile.c v1.2 &&\n+\t\tcheck_file cvswork t3 v1.2 &&\n+\t\tcheck_file cvswork adir/afile v1.2 &&\n+\t\tcheck_file cvswork adir/a3file v1.2 &&\n+\t\tcheck_file cvswork adir/bdir/bfile v1.2 &&\n+\t\tcheck_file cvswork adir/bdir/b3file v1.2 &&\n+\t\tcheck_file cvswork cdir/cfile v1.2 &&\n+\t\tcheck_end_tree cvswork\n '\n \n # Make sure \"CVS/Tag\" files didn't get messed up:\n test_expect_success 'cvs up (on b1 /) (again; check CVS/Tag files)' '\n-    ( cd cvswork &&\n-      cvs -f up -d ) >cvs.log 2>&1 &&\n-    check_start_tree cvswork &&\n-    check_file cvswork textfile.c v1.2 &&\n-    check_file cvswork t3 v1.2 &&\n-    check_file cvswork adir/afile v1.2 &&\n-    check_file cvswork adir/a3file v1.2 &&\n-    check_file cvswork adir/bdir/bfile v1.2 &&\n-    check_file cvswork adir/bdir/b3file v1.2 &&\n-    check_file cvswork cdir/cfile v1.2 &&\n-    check_end_tree cvswork\n+\t\t( cd cvswork &&\n+\t\t\tcvs -f up -d ) >cvs.log 2>&1 &&\n+\t\tcheck_start_tree cvswork &&\n+\t\tcheck_file cvswork textfile.c v1.2 &&\n+\t\tcheck_file cvswork t3 v1.2 &&\n+\t\tcheck_file cvswork adir/afile v1.2 &&\n+\t\tcheck_file cvswork adir/a3file v1.2 &&\n+\t\tcheck_file cvswork adir/bdir/bfile v1.2 &&\n+\t\tcheck_file cvswork adir/bdir/b3file v1.2 &&\n+\t\tcheck_file cvswork cdir/cfile v1.2 &&\n+\t\tcheck_end_tree cvswork\n '\n \n # update to another version:\n test_expect_success 'cvs up -r v1' '\n-    ( cd cvswork &&\n-      cvs -f up -r v1 ) >cvs.log 2>&1 &&\n-    check_start_tree cvswork &&\n-    check_file cvswork textfile.c v1 &&\n-    check_file cvswork t2 v1 &&\n-    check_file cvswork adir/afile v1 &&\n-    check_file cvswork adir/a2file v1 &&\n-    check_file cvswork adir/bdir/bfile v1 &&\n-    check_file cvswork adir/bdir/b2file v1 &&\n-    check_end_tree cvswork\n+\t\t( cd cvswork &&\n+\t\t\tcvs -f up -r v1 ) >cvs.log 2>&1 &&\n+\t\tcheck_start_tree cvswork &&\n+\t\tcheck_file cvswork textfile.c v1 &&\n+\t\tcheck_file cvswork t2 v1 &&\n+\t\tcheck_file cvswork adir/afile v1 &&\n+\t\tcheck_file cvswork adir/a2file v1 &&\n+\t\tcheck_file cvswork adir/bdir/bfile v1 &&\n+\t\tcheck_file cvswork adir/bdir/b2file v1 &&\n+\t\tcheck_end_tree cvswork\n '\n \n test_expect_success 'cvs up' '\n-    ( cd cvswork &&\n-      cvs -f up ) >cvs.log 2>&1 &&\n-    check_start_tree cvswork &&\n-    check_file cvswork textfile.c v1 &&\n-    check_file cvswork t2 v1 &&\n-    check_file cvswork adir/afile v1 &&\n-    check_file cvswork adir/a2file v1 &&\n-    check_file cvswork adir/bdir/bfile v1 &&\n-    check_file cvswork adir/bdir/b2file v1 &&\n-    check_end_tree cvswork\n+\t\t( cd cvswork &&\n+\t\t\tcvs -f up ) >cvs.log 2>&1 &&\n+\t\tcheck_start_tree cvswork &&\n+\t\tcheck_file cvswork textfile.c v1 &&\n+\t\tcheck_file cvswork t2 v1 &&\n+\t\tcheck_file cvswork adir/afile v1 &&\n+\t\tcheck_file cvswork adir/a2file v1 &&\n+\t\tcheck_file cvswork adir/bdir/bfile v1 &&\n+\t\tcheck_file cvswork adir/bdir/b2file v1 &&\n+\t\tcheck_end_tree cvswork\n '\n \n test_expect_success 'cvs up (again; check CVS/Tag files)' '\n-    ( cd cvswork &&\n-      cvs -f up -d ) >cvs.log 2>&1 &&\n-    check_start_tree cvswork &&\n-    check_file cvswork textfile.c v1 &&\n-    check_file cvswork t2 v1 &&\n-    check_file cvswork adir/afile v1 &&\n-    check_file cvswork adir/a2file v1 &&\n-    check_file cvswork adir/bdir/bfile v1 &&\n-    check_file cvswork adir/bdir/b2file v1 &&\n-    check_end_tree cvswork\n+\t\t( cd cvswork &&\n+\t\t\tcvs -f up -d ) >cvs.log 2>&1 &&\n+\t\tcheck_start_tree cvswork &&\n+\t\tcheck_file cvswork textfile.c v1 &&\n+\t\tcheck_file cvswork t2 v1 &&\n+\t\tcheck_file cvswork adir/afile v1 &&\n+\t\tcheck_file cvswork adir/a2file v1 &&\n+\t\tcheck_file cvswork adir/bdir/bfile v1 &&\n+\t\tcheck_file cvswork adir/bdir/b2file v1 &&\n+\t\tcheck_end_tree cvswork\n '\n \n test_expect_success 'setup simple b2' '\n-    git branch b2 v1 &&\n-    git push --tags gitcvs.git b2:b2\n+\t\tgit branch b2 v1 &&\n+\t\tgit push --tags gitcvs.git b2:b2\n '\n \n test_expect_success 'cvs co b2 [into cvswork2]' '\n-    cvs -f co -r b2 -d cvswork2 master >cvs.log 2>&1 &&\n-    check_start_tree cvswork &&\n-    check_file cvswork textfile.c v1 &&\n-    check_file cvswork t2 v1 &&\n-    check_file cvswork adir/afile v1 &&\n-    check_file cvswork adir/a2file v1 &&\n-    check_file cvswork adir/bdir/bfile v1 &&\n-    check_file cvswork adir/bdir/b2file v1 &&\n-    check_end_tree cvswork\n+\t\tcvs -f co -r b2 -d cvswork2 master >cvs.log 2>&1 &&\n+\t\tcheck_start_tree cvswork &&\n+\t\tcheck_file cvswork textfile.c v1 &&\n+\t\tcheck_file cvswork t2 v1 &&\n+\t\tcheck_file cvswork adir/afile v1 &&\n+\t\tcheck_file cvswork adir/a2file v1 &&\n+\t\tcheck_file cvswork adir/bdir/bfile v1 &&\n+\t\tcheck_file cvswork adir/bdir/b2file v1 &&\n+\t\tcheck_end_tree cvswork\n '\n \n test_expect_success 'root dir edit [cvswork2]' '\n-    ( cd cvswork2 &&\n-      echo \"Line 2\" >> textfile.c &&\n-      test_must_fail cvs -f diff -u >\"$WORKDIR/cvsEdit1.diff\" &&\n-      cvs -f commit -m \"edit textfile.c\" textfile.c\n-    ) >cvsEdit1.log 2>&1\n+\t\t( cd cvswork2 &&\n+\t\t\techo \"Line 2\" >> textfile.c &&\n+\t\t\ttest_must_fail cvs -f diff -u >\"$WORKDIR/cvsEdit1.diff\" &&\n+\t\t\tcvs -f commit -m \"edit textfile.c\" textfile.c\n+\t\t) >cvsEdit1.log 2>&1\n '\n \n test_expect_success 'root dir rm file [cvswork2]' '\n-    ( cd cvswork2 &&\n-      cvs -f rm -f t2 &&\n-      cvs -f diff -u > ../cvsEdit2-empty.diff &&\n-      test_must_fail cvs -f diff -N -u >\"$WORKDIR/cvsEdit2-N.diff\" &&\n-      cvs -f commit -m \"rm t2\"\n-    ) > cvsEdit2.log 2>&1\n+\t\t( cd cvswork2 &&\n+\t\t\tcvs -f rm -f t2 &&\n+\t\t\tcvs -f diff -u > ../cvsEdit2-empty.diff &&\n+\t\t\ttest_must_fail cvs -f diff -N -u >\"$WORKDIR/cvsEdit2-N.diff\" &&\n+\t\t\tcvs -f commit -m \"rm t2\"\n+\t\t) > cvsEdit2.log 2>&1\n '\n \n test_expect_success 'subdir edit/add/rm files [cvswork2' '\n-    ( cd cvswork2 &&\n-      sed -i -e \"s/line 1/line 1 (v2)/\" adir/bdir/bfile &&\n-      rm adir/bdir/b2file &&\n-      cd adir &&\n-      cvs -f rm bdir/b2file &&\n-      echo \"4th file\" > bdir/b4file &&\n-      cvs -f add bdir/b4file &&\n-      test_must_fail cvs -f diff -N -u >\"$WORKDIR/cvsEdit3.diff\" &&\n-      git fetch gitcvs.git b2:b2 &&\n-      ( cd .. &&\n+\t\t( cd cvswork2 &&\n+\t\t\tsed -e \"s/line 1/line 1 (v2)/\" adir/bdir/bfile >adir/bdir/bfileNEW &&\n+\t\t\tmv -f adir/bdir/bfileNEW adir/bdir/bfile &&\n+\t\t\trm adir/bdir/b2file &&\n+\t\t\tcd adir &&\n+\t\t\tcvs -f rm bdir/b2file &&\n+\t\t\techo \"4th file\" > bdir/b4file &&\n+\t\t\tcvs -f add bdir/b4file &&\n+\t\t\ttest_must_fail cvs -f diff -N -u >\"$WORKDIR/cvsEdit3.diff\" &&\n+\t\t\tgit fetch gitcvs.git b2:b2 &&\n+\t\t\t( cd .. &&\n \ttest_must_fail cvs -f diff -u -N -r v1.2 >\"$WORKDIR/cvsEdit3-v1.2.diff\" &&\n \ttest_must_fail cvs -f diff -u -N -r v1.2 -r v1 >\"$WORKDIR/cvsEdit3-v1.2-v1.diff\"\n-      ) &&\n-      cvs -f commit -m \"various add/rm/edit\"\n-    ) >cvs.log 2>&1\n+\t\t\t) &&\n+\t\t\tcvs -f commit -m \"various add/rm/edit\"\n+\t\t) >cvs.log 2>&1\n '\n \n test_expect_success 'validate result of edits [cvswork2]' '\n-    git fetch gitcvs.git b2:b2 &&\n-    git tag v2 b2 &&\n-    git push --tags gitcvs.git b2:b2 &&\n-    check_start_tree cvswork2 &&\n-    check_file cvswork2 textfile.c v2 &&\n-    check_file cvswork2 adir/afile v2 &&\n-    check_file cvswork2 adir/a2file v2 &&\n-    check_file cvswork2 adir/bdir/bfile v2 &&\n-    check_file cvswork2 adir/bdir/b4file v2 &&\n-    check_end_full_tree cvswork2 v2\n+\t\tgit fetch gitcvs.git b2:b2 &&\n+\t\tgit tag v2 b2 &&\n+\t\tgit push --tags gitcvs.git b2:b2 &&\n+\t\tcheck_start_tree cvswork2 &&\n+\t\tcheck_file cvswork2 textfile.c v2 &&\n+\t\tcheck_file cvswork2 adir/afile v2 &&\n+\t\tcheck_file cvswork2 adir/a2file v2 &&\n+\t\tcheck_file cvswork2 adir/bdir/bfile v2 &&\n+\t\tcheck_file cvswork2 adir/bdir/b4file v2 &&\n+\t\tcheck_end_full_tree cvswork2 v2\n '\n \n test_expect_success 'validate basic diffs saved during above cvswork2 edits' '\n-    test $(grep Index: cvsEdit1.diff | wc -l) = 1 &&\n-    test ! -s cvsEdit2-empty.diff &&\n-    test $(grep Index: cvsEdit2-N.diff | wc -l) = 1 &&\n-    test $(grep Index: cvsEdit3.diff | wc -l) = 3 &&\n-    rm -rf diffSandbox &&\n-    git clone -q -n . diffSandbox &&\n-    ( cd diffSandbox &&\n-      git checkout v1 &&\n-      git apply -p0 --index <\"$WORKDIR/cvsEdit1.diff\" &&\n-      git apply -p0 --index <\"$WORKDIR/cvsEdit2-N.diff\" &&\n-      git apply -p0 --directory=adir --index <\"$WORKDIR/cvsEdit3.diff\" &&\n-      git diff --exit-code v2 ) >\"check_diff_apply.out\" 2>&1\n+\t\ttest $(grep Index: cvsEdit1.diff | wc -l) = 1 &&\n+\t\ttest ! -s cvsEdit2-empty.diff &&\n+\t\ttest $(grep Index: cvsEdit2-N.diff | wc -l) = 1 &&\n+\t\ttest $(grep Index: cvsEdit3.diff | wc -l) = 3 &&\n+\t\trm -rf diffSandbox &&\n+\t\tgit clone -q -n . diffSandbox &&\n+\t\t( cd diffSandbox &&\n+\t\t\tgit checkout v1 &&\n+\t\t\tgit apply -p0 --index <\"$WORKDIR/cvsEdit1.diff\" &&\n+\t\t\tgit apply -p0 --index <\"$WORKDIR/cvsEdit2-N.diff\" &&\n+\t\t\tgit apply -p0 --directory=adir --index <\"$WORKDIR/cvsEdit3.diff\" &&\n+\t\t\tgit diff --exit-code v2 ) >\"check_diff_apply.out\" 2>&1\n '\n \n test_expect_success 'validate v1.2 diff saved during last cvswork2 edit' '\n-    test $(grep Index: cvsEdit3-v1.2.diff | wc -l) = 9 &&\n-    check_diff cvsEdit3-v1.2.diff v1.2 v2\n+\t\ttest $(grep Index: cvsEdit3-v1.2.diff | wc -l) = 9 &&\n+\t\tcheck_diff cvsEdit3-v1.2.diff v1.2 v2\n '\n \n test_expect_success 'validate v1.2 v1 diff saved during last cvswork2 edit' '\n-    test $(grep Index: cvsEdit3-v1.2-v1.diff | wc -l) = 9 &&\n-    check_diff cvsEdit3-v1.2-v1.diff v1.2 v1\n+\t\ttest $(grep Index: cvsEdit3-v1.2-v1.diff | wc -l) = 9 &&\n+\t\tcheck_diff cvsEdit3-v1.2-v1.diff v1.2 v1\n '\n \n test_expect_success 'cvs up [cvswork2]' '\n-    ( cd cvswork2 &&\n-      cvs -f up ) >cvs.log 2>&1 &&\n-    check_start_tree cvswork2 &&\n-    check_file cvswork2 textfile.c v2 &&\n-    check_file cvswork2 adir/afile v2 &&\n-    check_file cvswork2 adir/a2file v2 &&\n-    check_file cvswork2 adir/bdir/bfile v2 &&\n-    check_file cvswork2 adir/bdir/b4file v2 &&\n-    check_end_full_tree cvswork2 v2\n+\t\t( cd cvswork2 &&\n+\t\t\tcvs -f up ) >cvs.log 2>&1 &&\n+\t\tcheck_start_tree cvswork2 &&\n+\t\tcheck_file cvswork2 textfile.c v2 &&\n+\t\tcheck_file cvswork2 adir/afile v2 &&\n+\t\tcheck_file cvswork2 adir/a2file v2 &&\n+\t\tcheck_file cvswork2 adir/bdir/bfile v2 &&\n+\t\tcheck_file cvswork2 adir/bdir/b4file v2 &&\n+\t\tcheck_end_full_tree cvswork2 v2\n '\n \n test_expect_success 'cvs up -r b2 [back to cvswork]' '\n-    ( cd cvswork &&\n-      cvs -f up -r b2 ) >cvs.log 2>&1 &&\n-    check_start_tree cvswork &&\n-    check_file cvswork textfile.c v2 &&\n-    check_file cvswork adir/afile v2 &&\n-    check_file cvswork adir/a2file v2 &&\n-    check_file cvswork adir/bdir/bfile v2 &&\n-    check_file cvswork adir/bdir/b4file v2 &&\n-    check_end_full_tree cvswork v2\n+\t\t( cd cvswork &&\n+\t\t\tcvs -f up -r b2 ) >cvs.log 2>&1 &&\n+\t\tcheck_start_tree cvswork &&\n+\t\tcheck_file cvswork textfile.c v2 &&\n+\t\tcheck_file cvswork adir/afile v2 &&\n+\t\tcheck_file cvswork adir/a2file v2 &&\n+\t\tcheck_file cvswork adir/bdir/bfile v2 &&\n+\t\tcheck_file cvswork adir/bdir/b4file v2 &&\n+\t\tcheck_end_full_tree cvswork v2\n '\n \n test_expect_success 'cvs up -r b1' '\n-    ( cd cvswork &&\n-      cvs -f up -r b1 ) >cvs.log 2>&1 &&\n-    check_start_tree cvswork &&\n-    check_file cvswork textfile.c v1.2 &&\n-    check_file cvswork t3 v1.2 &&\n-    check_file cvswork adir/afile v1.2 &&\n-    check_file cvswork adir/a3file v1.2 &&\n-    check_file cvswork adir/bdir/bfile v1.2 &&\n-    check_file cvswork adir/bdir/b3file v1.2 &&\n-    check_file cvswork cdir/cfile v1.2 &&\n-    check_end_full_tree cvswork v1.2\n+\t\t( cd cvswork &&\n+\t\t\tcvs -f up -r b1 ) >cvs.log 2>&1 &&\n+\t\tcheck_start_tree cvswork &&\n+\t\tcheck_file cvswork textfile.c v1.2 &&\n+\t\tcheck_file cvswork t3 v1.2 &&\n+\t\tcheck_file cvswork adir/afile v1.2 &&\n+\t\tcheck_file cvswork adir/a3file v1.2 &&\n+\t\tcheck_file cvswork adir/bdir/bfile v1.2 &&\n+\t\tcheck_file cvswork adir/bdir/b3file v1.2 &&\n+\t\tcheck_file cvswork cdir/cfile v1.2 &&\n+\t\tcheck_end_full_tree cvswork v1.2\n '\n \n test_expect_success 'cvs up -A' '\n-    ( cd cvswork &&\n-      cvs -f up -A ) >cvs.log 2>&1 &&\n-    check_start_tree cvswork &&\n-    check_file cvswork textfile.c v1 &&\n-    check_file cvswork t2 v1 &&\n-    check_file cvswork adir/afile v1 &&\n-    check_file cvswork adir/a2file v1 &&\n-    check_file cvswork adir/bdir/bfile v1 &&\n-    check_file cvswork adir/bdir/b2file v1 &&\n-    check_end_full_tree cvswork v1\n+\t\t( cd cvswork &&\n+\t\t\tcvs -f up -A ) >cvs.log 2>&1 &&\n+\t\tcheck_start_tree cvswork &&\n+\t\tcheck_file cvswork textfile.c v1 &&\n+\t\tcheck_file cvswork t2 v1 &&\n+\t\tcheck_file cvswork adir/afile v1 &&\n+\t\tcheck_file cvswork adir/a2file v1 &&\n+\t\tcheck_file cvswork adir/bdir/bfile v1 &&\n+\t\tcheck_file cvswork adir/bdir/b2file v1 &&\n+\t\tcheck_end_full_tree cvswork v1\n '\n \n test_expect_success 'cvs up (check CVS/Tag files)' '\n-    ( cd cvswork &&\n-      cvs -f up ) >cvs.log 2>&1 &&\n-    check_start_tree cvswork &&\n-    check_file cvswork textfile.c v1 &&\n-    check_file cvswork t2 v1 &&\n-    check_file cvswork adir/afile v1 &&\n-    check_file cvswork adir/a2file v1 &&\n-    check_file cvswork adir/bdir/bfile v1 &&\n-    check_file cvswork adir/bdir/b2file v1 &&\n-    check_end_full_tree cvswork v1\n+\t\t( cd cvswork &&\n+\t\t\tcvs -f up ) >cvs.log 2>&1 &&\n+\t\tcheck_start_tree cvswork &&\n+\t\tcheck_file cvswork textfile.c v1 &&\n+\t\tcheck_file cvswork t2 v1 &&\n+\t\tcheck_file cvswork adir/afile v1 &&\n+\t\tcheck_file cvswork adir/a2file v1 &&\n+\t\tcheck_file cvswork adir/bdir/bfile v1 &&\n+\t\tcheck_file cvswork adir/bdir/b2file v1 &&\n+\t\tcheck_end_full_tree cvswork v1\n '\n \n # This is not really legal CVS, but it seems to work anyway:\n test_expect_success 'cvs up -r heads/b1' '\n-    ( cd cvswork &&\n-      cvs -f up -r heads/b1 ) >cvs.log 2>&1 &&\n-    check_start_tree cvswork &&\n-    check_file cvswork textfile.c v1.2 &&\n-    check_file cvswork t3 v1.2 &&\n-    check_file cvswork adir/afile v1.2 &&\n-    check_file cvswork adir/a3file v1.2 &&\n-    check_file cvswork adir/bdir/bfile v1.2 &&\n-    check_file cvswork adir/bdir/b3file v1.2 &&\n-    check_file cvswork cdir/cfile v1.2 &&\n-    check_end_full_tree cvswork v1.2\n+\t\t( cd cvswork &&\n+\t\t\tcvs -f up -r heads/b1 ) >cvs.log 2>&1 &&\n+\t\tcheck_start_tree cvswork &&\n+\t\tcheck_file cvswork textfile.c v1.2 &&\n+\t\tcheck_file cvswork t3 v1.2 &&\n+\t\tcheck_file cvswork adir/afile v1.2 &&\n+\t\tcheck_file cvswork adir/a3file v1.2 &&\n+\t\tcheck_file cvswork adir/bdir/bfile v1.2 &&\n+\t\tcheck_file cvswork adir/bdir/b3file v1.2 &&\n+\t\tcheck_file cvswork cdir/cfile v1.2 &&\n+\t\tcheck_end_full_tree cvswork v1.2\n '\n \n # But this should work even if CVS client checks -r more carefully:\n test_expect_success 'cvs up -r heads_-s-b2 (cvsserver escape mechanism)' '\n-    ( cd cvswork &&\n-      cvs -f up -r heads_-s-b2 ) >cvs.log 2>&1 &&\n-    check_start_tree cvswork &&\n-    check_file cvswork textfile.c v2 &&\n-    check_file cvswork adir/afile v2 &&\n-    check_file cvswork adir/a2file v2 &&\n-    check_file cvswork adir/bdir/bfile v2 &&\n-    check_file cvswork adir/bdir/b4file v2 &&\n-    check_end_full_tree cvswork v2\n+\t\t( cd cvswork &&\n+\t\t\tcvs -f up -r heads_-s-b2 ) >cvs.log 2>&1 &&\n+\t\tcheck_start_tree cvswork &&\n+\t\tcheck_file cvswork textfile.c v2 &&\n+\t\tcheck_file cvswork adir/afile v2 &&\n+\t\tcheck_file cvswork adir/a2file v2 &&\n+\t\tcheck_file cvswork adir/bdir/bfile v2 &&\n+\t\tcheck_file cvswork adir/bdir/b4file v2 &&\n+\t\tcheck_end_full_tree cvswork v2\n '\n \n v1hash=$(git rev-parse v1)\n test_expect_success 'cvs up -r $(git rev-parse v1)' '\n-    test -n \"$v1hash\" &&\n-    ( cd cvswork &&\n-      cvs -f up -r \"$v1hash\" ) >cvs.log 2>&1 &&\n-    check_start_tree cvswork &&\n-    check_file cvswork textfile.c v1 &&\n-    check_file cvswork t2 v1 &&\n-    check_file cvswork adir/afile v1 &&\n-    check_file cvswork adir/a2file v1 &&\n-    check_file cvswork adir/bdir/bfile v1 &&\n-    check_file cvswork adir/bdir/b2file v1 &&\n-    check_end_full_tree cvswork v1\n+\t\ttest -n \"$v1hash\" &&\n+\t\t( cd cvswork &&\n+\t\t\tcvs -f up -r \"$v1hash\" ) >cvs.log 2>&1 &&\n+\t\tcheck_start_tree cvswork &&\n+\t\tcheck_file cvswork textfile.c v1 &&\n+\t\tcheck_file cvswork t2 v1 &&\n+\t\tcheck_file cvswork adir/afile v1 &&\n+\t\tcheck_file cvswork adir/a2file v1 &&\n+\t\tcheck_file cvswork adir/bdir/bfile v1 &&\n+\t\tcheck_file cvswork adir/bdir/b2file v1 &&\n+\t\tcheck_end_full_tree cvswork v1\n '\n \n test_expect_success 'cvs diff -r v1 -u' '\n-    ( cd cvswork &&\n-      cvs -f diff -r v1 -u ) >cvsDiff.out 2>cvs.log &&\n-    test ! -s cvsDiff.out &&\n-    test ! -s cvs.log\n+\t\t( cd cvswork &&\n+\t\t\tcvs -f diff -r v1 -u ) >cvsDiff.out 2>cvs.log &&\n+\t\ttest ! -s cvsDiff.out &&\n+\t\ttest ! -s cvs.log\n '\n \n test_expect_success 'cvs diff -N -r v2 -u' '\n-    ( cd cvswork &&\n-      test_must_fail cvs -f diff -N -r v2 -u ) >cvsDiff.out 2>cvs.log &&\n-    test ! -s cvs.log &&\n-    test -s cvsDiff.out &&\n-    check_diff cvsDiff.out v2 v1 > check_diff.out 2>&1\n+\t\t( cd cvswork &&\n+\t\t\ttest_must_fail cvs -f diff -N -r v2 -u ) >cvsDiff.out 2>cvs.log &&\n+\t\ttest ! -s cvs.log &&\n+\t\ttest -s cvsDiff.out &&\n+\t\tcheck_diff cvsDiff.out v2 v1 > check_diff.out 2>&1\n '\n \n test_expect_success 'cvs diff -N -r v2 -r v1.2' '\n-    ( cd cvswork &&\n-      test_must_fail cvs -f diff -N -r v2 -r v1.2 -u ) >cvsDiff.out 2>cvs.log &&\n-    test ! -s cvs.log &&\n-    test -s cvsDiff.out &&\n-    check_diff cvsDiff.out v2 v1.2 > check_diff.out 2>&1\n+\t\t( cd cvswork &&\n+\t\t\ttest_must_fail cvs -f diff -N -r v2 -r v1.2 -u ) >cvsDiff.out 2>cvs.log &&\n+\t\ttest ! -s cvs.log &&\n+\t\ttest -s cvsDiff.out &&\n+\t\tcheck_diff cvsDiff.out v2 v1.2 > check_diff.out 2>&1\n '\n \n test_expect_success 'apply early [cvswork3] diff to b3' '\n-    git clone -q . gitwork3 &&\n-    ( cd gitwork3 &&\n-      git checkout -b b3 v1 &&\n-      git apply -p0 --index <\"$WORKDIR/cvswork3edit.diff\" &&\n-      git commit -m \"cvswork3 edits applied\" ) &&\n-    git fetch gitwork3 b3:b3 &&\n-    git tag v3 b3\n+\t\tgit clone -q . gitwork3 &&\n+\t\t( cd gitwork3 &&\n+\t\t\tgit checkout -b b3 v1 &&\n+\t\t\tgit apply -p0 --index <\"$WORKDIR/cvswork3edit.diff\" &&\n+\t\t\tgit commit -m \"cvswork3 edits applied\" ) &&\n+\t\tgit fetch gitwork3 b3:b3 &&\n+\t\tgit tag v3 b3\n '\n \n test_expect_success 'check [cvswork3] diff' '\n-    ( cd cvswork3 &&\n-      test_must_fail cvs -f diff -N -u ) >\"$WORKDIR/cvsDiff.out\" 2>cvs.log &&\n-    test ! -s cvs.log &&\n-    test -s cvsDiff.out &&\n-    test $(grep Index: cvsDiff.out | wc -l) = 3 &&\n-    test_cmp cvsDiff.out cvswork3edit.diff &&\n-    check_diff cvsDiff.out v1 v3 > check_diff.out 2>&1\n+\t\t( cd cvswork3 &&\n+\t\t\ttest_must_fail cvs -f diff -N -u ) >\"$WORKDIR/cvsDiff.out\" 2>cvs.log &&\n+\t\ttest ! -s cvs.log &&\n+\t\ttest -s cvsDiff.out &&\n+\t\ttest $(grep Index: cvsDiff.out | wc -l) = 3 &&\n+\t\ttest_cmp cvsDiff.out cvswork3edit.diff &&\n+\t\tcheck_diff cvsDiff.out v1 v3 > check_diff.out 2>&1\n '\n \n test_expect_success 'merge early [cvswork3] b3 with b1' '\n-    ( cd gitwork3 &&\n-      git merge \"message\" HEAD b1 )\n-    git fetch gitwork3 b3:b3 &&\n-    git tag v3merged b3 &&\n-    git push --tags gitcvs.git b3:b3\n+\t\t( cd gitwork3 &&\n+\t\t\tgit merge \"message\" HEAD b1 )\n+\t\tgit fetch gitwork3 b3:b3 &&\n+\t\tgit tag v3merged b3 &&\n+\t\tgit push --tags gitcvs.git b3:b3\n '\n \n # This test would fail if cvsserver properly created a \".#afile\"* file\n # for the merge.\n # TODO: Validate that the .# file was saved properly, and then\n-#   delete/ignore it when checking the tree.\n+#\t\tdelete/ignore it when checking the tree.\n test_expect_success 'cvs up dirty [cvswork3]' '\n-    ( cd cvswork3 &&\n-      cvs -f up &&\n-      test_must_fail cvs -f diff -N -u >\"$WORKDIR/cvsDiff.out\" ) >cvs.log 2>&1 &&\n-    test -s cvsDiff.out &&\n-    test $(grep Index: cvsDiff.out | wc -l) = 2\n-    check_start_tree cvswork3 &&\n-    check_file cvswork3 textfile.c v3merged &&\n-    check_file cvswork3 t3 v3merged &&\n-    check_file cvswork3 adir/afile v3merged &&\n-    check_file cvswork3 adir/a3file v3merged &&\n-    check_file cvswork3 adir/afile5 v3merged &&\n-    check_file cvswork3 adir/bdir/bfile v3merged &&\n-    check_file cvswork3 adir/bdir/b3file v3merged &&\n-    check_file cvswork3 cdir/cfile v3merged &&\n-    check_end_full_tree cvswork3 v3merged\n+\t\t( cd cvswork3 &&\n+\t\t\tcvs -f up &&\n+\t\t\ttest_must_fail cvs -f diff -N -u >\"$WORKDIR/cvsDiff.out\" ) >cvs.log 2>&1 &&\n+\t\ttest -s cvsDiff.out &&\n+\t\ttest $(grep Index: cvsDiff.out | wc -l) = 2\n+\t\tcheck_start_tree cvswork3 &&\n+\t\tcheck_file cvswork3 textfile.c v3merged &&\n+\t\tcheck_file cvswork3 t3 v3merged &&\n+\t\tcheck_file cvswork3 adir/afile v3merged &&\n+\t\tcheck_file cvswork3 adir/a3file v3merged &&\n+\t\tcheck_file cvswork3 adir/afile5 v3merged &&\n+\t\tcheck_file cvswork3 adir/bdir/bfile v3merged &&\n+\t\tcheck_file cvswork3 adir/bdir/b3file v3merged &&\n+\t\tcheck_file cvswork3 cdir/cfile v3merged &&\n+\t\tcheck_end_full_tree cvswork3 v3merged\n '\n \n # TODO: test cvs status\n \n test_expect_success 'cvs commit [cvswork3' '\n-    ( cd cvswork3 &&\n-      cvs -f commit -m \"dirty sandbox after auto-merge\"\n-    ) > cvs.log 2>&1 &&\n-    check_start_tree cvswork3 &&\n-    check_file cvswork3 textfile.c v3merged &&\n-    check_file cvswork3 t3 v3merged &&\n-    check_file cvswork3 adir/afile v3merged &&\n-    check_file cvswork3 adir/a3file v3merged &&\n-    check_file cvswork3 adir/afile5 v3merged &&\n-    check_file cvswork3 adir/bdir/bfile v3merged &&\n-    check_file cvswork3 adir/bdir/b3file v3merged &&\n-    check_file cvswork3 cdir/cfile v3merged &&\n-    check_end_full_tree cvswork3 v3merged &&\n-    git fetch gitcvs.git b3:b4 &&\n-    git tag v4.1 b4 &&\n-    git diff --exit-code v4.1 v3merged > check_diff_apply.out 2>&1\n+\t\t( cd cvswork3 &&\n+\t\t\tcvs -f commit -m \"dirty sandbox after auto-merge\"\n+\t\t) > cvs.log 2>&1 &&\n+\t\tcheck_start_tree cvswork3 &&\n+\t\tcheck_file cvswork3 textfile.c v3merged &&\n+\t\tcheck_file cvswork3 t3 v3merged &&\n+\t\tcheck_file cvswork3 adir/afile v3merged &&\n+\t\tcheck_file cvswork3 adir/a3file v3merged &&\n+\t\tcheck_file cvswork3 adir/afile5 v3merged &&\n+\t\tcheck_file cvswork3 adir/bdir/bfile v3merged &&\n+\t\tcheck_file cvswork3 adir/bdir/b3file v3merged &&\n+\t\tcheck_file cvswork3 cdir/cfile v3merged &&\n+\t\tcheck_end_full_tree cvswork3 v3merged &&\n+\t\tgit fetch gitcvs.git b3:b4 &&\n+\t\tgit tag v4.1 b4 &&\n+\t\tgit diff --exit-code v4.1 v3merged > check_diff_apply.out 2>&1\n '\n \n test_done\n-- \n1.8.0.197.g5a90748\n"},{"id":"204453","messageId":"7v4nk3t6uv.fsf@alter.siamese.dyndns.org","threadId":"32261","inReplyTo":"201212021322.45418.tboegi@web.de","subject":"Re: [PATCH] t9402: sed -i is not portable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-12-03T16:53:28Z","receivedAt":"2012-12-03T16:53:28Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Torsten Bögershausen <tboegi@web.de> writes:\n\n> On some systems sed allows the usage of e.g.\n> sed -i -e \"s/line1/line2/\" afile\n> to edit the file \"in place\".\n> Other systems don't allow that: one observed behaviour is that\n> sed -i -e \"s/line1/line2/\" afile\n> creates a backup file called afile-e, which breaks the test.\n> As sed -i is not part of POSIX, avoid it.\n>\n> Use test_cmp, makes the test easier to debug.\n> Chain all shell commands with && to detect all kinds of failure.\n> While at it, Use TAB to indent.\n>\n> Signed-off-by: Torsten Bögershausen <tboegi@web.de>\n> ---\n> Note: this should go on top of pu\n>\n>  t/t9402-git-cvsserver-refs.sh | 764 +++++++++++++++++++++---------------------\n>  1 file changed, 383 insertions(+), 381 deletions(-)\n>\n> diff --git a/t/t9402-git-cvsserver-refs.sh b/t/t9402-git-cvsserver-refs.sh\n> index 858ef0f..39c6b01 100755\n> --- a/t/t9402-git-cvsserver-refs.sh\n> +++ b/t/t9402-git-cvsserver-refs.sh\n> @@ -10,59 +10,58 @@ tags, branches and other git refspecs'\n>  #########\n>  \n>  check_start_tree() {\n> -    rm -f \"$WORKDIR/check.list\"\n> -    echo \"start $1\" >> \"${WORKDIR}/check.log\"\n> +\t\trm -f \"$WORKDIR/check.list\"\n> +\t\techo \"start $1\" >> \"${WORKDIR}/check.log\"\n\nI think the indentation is broken throughout the patch.  Why two\ntabs at the beginning?\n\nPlease do not do many unrelated things at once in a commit, as it\nmakes the changes unnecessarily noisy for reviewing.  When a\nreviewer wants to concentrate on formatting, changes to other text\nbecome distracting.  When a reviewer wants to concentrate on the\nlogic of replacing \"sed -i\" with a temporary file, formatting\nchanges become distracting.\n\nIf you want to fix \"sed -i\", do that and only that in one patch.  If\nyou want to fix indentation and other style fixes (which is a good\nthing to do), do that and only that in a separate patch, either\nbefore or after the main patch.\n\nThanks.\n\n>  }\n>  \n>  check_file() {\n> -    sandbox=\"$1\"\n> -    file=\"$2\"\n> -    ver=\"$3\"\n> -    GIT_DIR=$SERVERDIR git show \"${ver}:${file}\" \\\n> +\t\tsandbox=\"$1\"\n> +\t\tfile=\"$2\"\n> +\t\tver=\"$3\"\n> +\t\tGIT_DIR=$SERVERDIR git show \"${ver}:${file}\" \\\n>  \t> \"$WORKDIR/check.got\" 2> \"$WORKDIR/check.stderr\"\n> -    test_cmp \"$WORKDIR/check.got\" \"$sandbox/$file\"\n> -    stat=$?\n> -    echo \"check_file $sandbox $file $ver : $stat\" >> \"$WORKDIR/check.log\"\n> -    echo \"$file\" >> \"$WORKDIR/check.list\"\n> -    return $stat\n> +\t\ttest_cmp \"$WORKDIR/check.got\" \"$sandbox/$file\"\n> +\t\tstat=$?\n> +\t\techo \"check_file $sandbox $file $ver : $stat\" >> \"$WORKDIR/check.log\"\n> +\t\techo \"$file\" >> \"$WORKDIR/check.list\"\n> +\t\treturn $stat\n>  }\n>  \n>  check_end_tree() {\n> -    sandbox=\"$1\"\n> -    expectCount=$(wc -l < \"$WORKDIR/check.list\")\n> -    cvsCount=$(find \"$sandbox\" -name CVS -prune -o -type f -print | wc -l)\n> -    test x\"$cvsCount\" = x\"$expectCount\"\n> -    stat=$?\n> -    echo \"check_end $sandbox : $stat cvs=$cvsCount expect=$expectCount\" \\\n> -\t>> \"$WORKDIR/check.log\"\n> -    return $stat\n> +\t\tsandbox=\"$1\" &&\n> +\t\twc -l < \"$WORKDIR/check.list\" > expected &&\n> +\t\tfind \"$sandbox\" -type f | grep -v \"/CVS\" > \"$WORKDIR/check.cvsCount\" &&\n> +\t\twc -l < \"$WORKDIR/check.cvsCount\" >actual &&\n> +\t\ttest_cmp expected actual &&\n> +\t\trm expected actual &&\n> +\t\tsort < \"$WORKDIR/check.list\" > expected &&\n> +\t\tsort < \"$WORKDIR/check.cvsCount\" | sed -e \"s%cvswork/%%\" >actual &&\n> +\t\ttest_cmp expected actual &&\n> +\t\trm expected actual\n>  }\n>  \n>  check_end_full_tree() {\n> -    sandbox=\"$1\"\n> -    ver=\"$2\"\n> -    expectCount=$(wc -l < \"$WORKDIR/check.list\")\n> -    cvsCount=$(find \"$sandbox\" -name CVS -prune -o -type f -print | wc -l)\n> -    gitCount=$(git ls-tree -r \"$2\" | wc -l)\n> -    test x\"$cvsCount\" = x\"$expectCount\" -a x\"$gitCount\" = x\"$expectCount\"\n> -    stat=$?\n> -    echo \"check_end $sandbox : $stat cvs=$cvsCount git=$gitCount expect=$expectCount\" \\\n> -\t>> \"$WORKDIR/check.log\"\n> -    return $stat\n> +\t\tsandbox=\"$1\" &&\n> +\t\tsort < \"$WORKDIR/check.list\" >expected &&\n> +\t\tfind \"$sandbox\" -name CVS -prune -o -type f -print | sed -e \"s%$sandbox/%%\" | sort >act1 &&\n> +\t\ttest_cmp expected act1 &&\n> +\t\tgit ls-tree -r \"$2\" | sed -e \"s/^.*blob [0-9a-fA-F]*[\t ]*//\" | sort > act2 &&\n> +\t\ttest_cmp expected act2 &&\n> +\t\trm expected act1 act2\n>  }\n>  \n>  #########\n>  \n>  check_diff() {\n> -    diffFile=\"$1\"\n> -    vOld=\"$2\"\n> -    vNew=\"$3\"\n> -    rm -rf diffSandbox\n> -    git clone -q -n . diffSandbox &&\n> -    ( cd diffSandbox &&\n> -      git checkout \"$vOld\" &&\n> -      git apply -p0 --index <\"../$diffFile\" &&\n> -      git diff --exit-code \"$vNew\" ) > check_diff_apply.out 2>&1\n> +\t\tdiffFile=\"$1\"\n> +\t\tvOld=\"$2\"\n> +\t\tvNew=\"$3\"\n> +\t\trm -rf diffSandbox\n> +\t\tgit clone -q -n . diffSandbox &&\n> +\t\t( cd diffSandbox &&\n> +\t\t\tgit checkout \"$vOld\" &&\n> +\t\t\tgit apply -p0 --index <\"../$diffFile\" &&\n> +\t\t\tgit diff --exit-code \"$vNew\" ) > check_diff_apply.out 2>&1\n>  }\n>  \n>  #########\n> @@ -70,17 +69,17 @@ check_diff() {\n>  cvs >/dev/null 2>&1\n>  if test $? -ne 1\n>  then\n> -    skip_all='skipping git-cvsserver tests, cvs not found'\n> -    test_done\n> +\t\tskip_all='skipping git-cvsserver tests, cvs not found'\n> +\t\ttest_done\n>  fi\n>  if ! test_have_prereq PERL\n>  then\n> -    skip_all='skipping git-cvsserver tests, perl not available'\n> -    test_done\n> +\t\tskip_all='skipping git-cvsserver tests, perl not available'\n> +\t\ttest_done\n>  fi\n>  \"$PERL_PATH\" -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {\n> -    skip_all='skipping git-cvsserver tests, Perl SQLite interface unavailable'\n> -    test_done\n> +\t\tskip_all='skipping git-cvsserver tests, Perl SQLite interface unavailable'\n> +\t\ttest_done\n>  }\n>  \n>  unset GIT_DIR GIT_CONFIG\n> @@ -94,465 +93,468 @@ export CVSROOT CVS_SERVER\n>  \n>  rm -rf \"$CVSWORK\" \"$SERVERDIR\"\n>  test_expect_success 'setup v1, b1' '\n> -    echo \"Simple text file\" > textfile.c &&\n> -    echo \"t2\" > t2 &&\n> -    mkdir adir &&\n> -    echo \"adir/afile line1\" > adir/afile &&\n> -    echo \"adir/afile line2\" >> adir/afile &&\n> -    echo \"adir/afile line3\" >> adir/afile &&\n> -    echo \"adir/afile line4\" >> adir/afile &&\n> -    echo \"adir/a2file\" >> adir/a2file &&\n> -    mkdir adir/bdir &&\n> -    echo \"adir/bdir/bfile line 1\" > adir/bdir/bfile &&\n> -    echo \"adir/bdir/bfile line 2\" >> adir/bdir/bfile &&\n> -    echo \"adir/bdir/b2file\" > adir/bdir/b2file &&\n> -    git add textfile.c t2 adir &&\n> -    git commit -q -m \"First Commit (v1)\" &&\n> -    git tag v1 &&\n> -    git branch b1 &&\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> +\t\techo \"Simple text file\" > textfile.c &&\n> +\t\techo \"t2\" > t2 &&\n> +\t\tmkdir adir &&\n> +\t\techo \"adir/afile line1\" > adir/afile &&\n> +\t\techo \"adir/afile line2\" >> adir/afile &&\n> +\t\techo \"adir/afile line3\" >> adir/afile &&\n> +\t\techo \"adir/afile line4\" >> adir/afile &&\n> +\t\techo \"adir/a2file\" >> adir/a2file &&\n> +\t\tmkdir adir/bdir &&\n> +\t\techo \"adir/bdir/bfile line 1\" > adir/bdir/bfile &&\n> +\t\techo \"adir/bdir/bfile line 2\" >> adir/bdir/bfile &&\n> +\t\techo \"adir/bdir/b2file\" > adir/bdir/b2file &&\n> +\t\tgit add textfile.c t2 adir &&\n> +\t\tgit commit -q -m \"First Commit (v1)\" &&\n> +\t\tgit tag v1 &&\n> +\t\tgit branch b1 &&\n> +\t\tgit clone -q --bare \"$WORKDIR/.git\" \"$SERVERDIR\" >/dev/null 2>&1 &&\n> +\t\tGIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.enabled true &&\n> +\t\tGIT_DIR=\"$SERVERDIR\" git config gitcvs.logfile \"$SERVERDIR/gitcvs.log\"\n>  '\n>  \n>  rm -rf cvswork\n>  test_expect_success 'cvs co v1' '\n> -    cvs -f -Q co -r v1 -d cvswork master >cvs.log 2>&1 &&\n> -    check_start_tree cvswork &&\n> -    check_file cvswork textfile.c v1 &&\n> -    check_file cvswork t2 v1 &&\n> -    check_file cvswork adir/afile v1 &&\n> -    check_file cvswork adir/a2file v1 &&\n> -    check_file cvswork adir/bdir/bfile v1 &&\n> -    check_file cvswork adir/bdir/b2file v1 &&\n> -    check_end_tree cvswork\n> +\t\tcvs -f -Q co -r v1 -d cvswork master >cvs.log 2>&1 &&\n> +\t\tcheck_start_tree cvswork &&\n> +\t\tcheck_file cvswork textfile.c v1 &&\n> +\t\tcheck_file cvswork t2 v1 &&\n> +\t\tcheck_file cvswork adir/afile v1 &&\n> +\t\tcheck_file cvswork adir/a2file v1 &&\n> +\t\tcheck_file cvswork adir/bdir/bfile v1 &&\n> +\t\tcheck_file cvswork adir/bdir/b2file v1 &&\n> +\t\tcheck_end_tree cvswork\n>  '\n>  \n>  rm -rf cvswork\n>  test_expect_success 'cvs co b1' '\n> -    cvs -f co -r b1 -d cvswork master >cvs.log 2>&1 &&\n> -    check_start_tree cvswork &&\n> -    check_file cvswork textfile.c v1 &&\n> -    check_file cvswork t2 v1 &&\n> -    check_file cvswork adir/afile v1 &&\n> -    check_file cvswork adir/a2file v1 &&\n> -    check_file cvswork adir/bdir/bfile v1 &&\n> -    check_file cvswork adir/bdir/b2file v1 &&\n> -    check_end_tree cvswork\n> +\t\tcvs -f co -r b1 -d cvswork master >cvs.log 2>&1 &&\n> +\t\tcheck_start_tree cvswork &&\n> +\t\tcheck_file cvswork textfile.c v1 &&\n> +\t\tcheck_file cvswork t2 v1 &&\n> +\t\tcheck_file cvswork adir/afile v1 &&\n> +\t\tcheck_file cvswork adir/a2file v1 &&\n> +\t\tcheck_file cvswork adir/bdir/bfile v1 &&\n> +\t\tcheck_file cvswork adir/bdir/b2file v1 &&\n> +\t\tcheck_end_tree cvswork\n>  '\n>  \n>  test_expect_success 'cvs co b1 [cvswork3]' '\n> -    cvs -f co -r b1 -d cvswork3 master >cvs.log 2>&1 &&\n> -    check_start_tree cvswork3 &&\n> -    check_file cvswork3 textfile.c v1 &&\n> -    check_file cvswork3 t2 v1 &&\n> -    check_file cvswork3 adir/afile v1 &&\n> -    check_file cvswork3 adir/a2file v1 &&\n> -    check_file cvswork3 adir/bdir/bfile v1 &&\n> -    check_file cvswork3 adir/bdir/b2file v1 &&\n> -    check_end_full_tree cvswork3 v1\n> +\t\tcvs -f co -r b1 -d cvswork3 master >cvs.log 2>&1 &&\n> +\t\tcheck_start_tree cvswork3 &&\n> +\t\tcheck_file cvswork3 textfile.c v1 &&\n> +\t\tcheck_file cvswork3 t2 v1 &&\n> +\t\tcheck_file cvswork3 adir/afile v1 &&\n> +\t\tcheck_file cvswork3 adir/a2file v1 &&\n> +\t\tcheck_file cvswork3 adir/bdir/bfile v1 &&\n> +\t\tcheck_file cvswork3 adir/bdir/b2file v1 &&\n> +\t\tcheck_end_full_tree cvswork3 v1\n>  '\n>  \n>  test_expect_success 'edit cvswork3 and save diff' '\n> -    ( cd cvswork3 &&\n> -      sed -i -e \"s/line1/line1 - data/\" adir/afile &&\n> -      echo \"afile5\" > adir/afile5 &&\n> -      rm t2 &&\n> -      cvs -f add adir/afile5 &&\n> -      cvs -f rm t2 &&\n> -      test_must_fail cvs -f diff -N -u >\"$WORKDIR/cvswork3edit.diff\"\n> -    )\n> +\t\t( cd cvswork3 &&\n> +\t\t\tsed -e \"s/line1/line1 - data/\" adir/afile >adir/afileNEW &&\n> +\t\t\tmv -f adir/afileNEW adir/afile &&\n> +\t\t\techo \"afile5\" > adir/afile5 &&\n> +\t\t\trm t2 &&\n> +\t\t\tcvs -f add adir/afile5 &&\n> +\t\t\tcvs -f rm t2 &&\n> +\t\t\ttest_must_fail cvs -f diff -N -u >\"$WORKDIR/cvswork3edit.diff\"\n> +\t\t)\n>  '\n>  \n>  test_expect_success 'setup v1.2 on b1' '\n> -    git checkout b1 &&\n> -    echo \"new v1.2\" > t3 &&\n> -    rm t2 &&\n> -    sed -i -e \"s/line3/line3 - more data/\" adir/afile &&\n> -    rm adir/a2file &&\n> -    echo \"a3file\" >> adir/a3file &&\n> -    echo \"bfile line 3\" >> adir/bdir/bfile &&\n> -    rm adir/bdir/b2file &&\n> -    echo \"b3file\" > adir/bdir/b3file &&\n> -    mkdir cdir &&\n> -    echo \"cdir/cfile\" > cdir/cfile &&\n> -    git add -A cdir adir t3 t2 &&\n> -    git commit -q -m 'v1.2' &&\n> -    git tag v1.2 &&\n> -    git push --tags gitcvs.git b1:b1\n> +\t\tgit checkout b1 &&\n> +\t\techo \"new v1.2\" > t3 &&\n> +\t\trm t2 &&\n> +\t\tsed -e \"s/line3/line3 - more data/\" adir/afile >adir/afileNEW &&\n> +\t\tmv -f adir/afileNEW adir/afile &&\n> +\t\trm adir/a2file &&\n> +\t\techo \"a3file\" >> adir/a3file &&\n> +\t\techo \"bfile line 3\" >> adir/bdir/bfile &&\n> +\t\trm adir/bdir/b2file &&\n> +\t\techo \"b3file\" > adir/bdir/b3file &&\n> +\t\tmkdir cdir &&\n> +\t\techo \"cdir/cfile\" > cdir/cfile &&\n> +\t\tgit add -A cdir adir t3 t2 &&\n> +\t\tgit commit -q -m 'v1.2' &&\n> +\t\tgit tag v1.2 &&\n> +\t\tgit push --tags gitcvs.git b1:b1\n>  '\n>  \n>  test_expect_success 'cvs -f up (on b1 adir)' '\n> -    ( cd cvswork/adir &&\n> -      cvs -f up -d ) >cvs.log 2>&1 &&\n> -    check_start_tree cvswork &&\n> -    check_file cvswork textfile.c v1 &&\n> -    check_file cvswork t2 v1 &&\n> -    check_file cvswork adir/afile v1.2 &&\n> -    check_file cvswork adir/a3file v1.2 &&\n> -    check_file cvswork adir/bdir/bfile v1.2 &&\n> -    check_file cvswork adir/bdir/b3file v1.2 &&\n> -    check_end_tree cvswork\n> +\t\t( cd cvswork/adir &&\n> +\t\t\tcvs -f up -d ) >cvs.log 2>&1 &&\n> +\t\tcheck_start_tree cvswork &&\n> +\t\tcheck_file cvswork textfile.c v1 &&\n> +\t\tcheck_file cvswork t2 v1 &&\n> +\t\tcheck_file cvswork adir/afile v1.2 &&\n> +\t\tcheck_file cvswork adir/a3file v1.2 &&\n> +\t\tcheck_file cvswork adir/bdir/bfile v1.2 &&\n> +\t\tcheck_file cvswork adir/bdir/b3file v1.2 &&\n> +\t\tcheck_end_tree cvswork\n>  '\n>  \n>  test_expect_success 'cvs up (on b1 /)' '\n> -    ( cd cvswork &&\n> -      cvs -f up -d ) >cvs.log 2>&1 &&\n> -    check_start_tree cvswork &&\n> -    check_file cvswork textfile.c v1.2 &&\n> -    check_file cvswork t3 v1.2 &&\n> -    check_file cvswork adir/afile v1.2 &&\n> -    check_file cvswork adir/a3file v1.2 &&\n> -    check_file cvswork adir/bdir/bfile v1.2 &&\n> -    check_file cvswork adir/bdir/b3file v1.2 &&\n> -    check_file cvswork cdir/cfile v1.2 &&\n> -    check_end_tree cvswork\n> +\t\t( cd cvswork &&\n> +\t\t\tcvs -f up -d ) >cvs.log 2>&1 &&\n> +\t\tcheck_start_tree cvswork &&\n> +\t\tcheck_file cvswork textfile.c v1.2 &&\n> +\t\tcheck_file cvswork t3 v1.2 &&\n> +\t\tcheck_file cvswork adir/afile v1.2 &&\n> +\t\tcheck_file cvswork adir/a3file v1.2 &&\n> +\t\tcheck_file cvswork adir/bdir/bfile v1.2 &&\n> +\t\tcheck_file cvswork adir/bdir/b3file v1.2 &&\n> +\t\tcheck_file cvswork cdir/cfile v1.2 &&\n> +\t\tcheck_end_tree cvswork\n>  '\n>  \n>  # Make sure \"CVS/Tag\" files didn't get messed up:\n>  test_expect_success 'cvs up (on b1 /) (again; check CVS/Tag files)' '\n> -    ( cd cvswork &&\n> -      cvs -f up -d ) >cvs.log 2>&1 &&\n> -    check_start_tree cvswork &&\n> -    check_file cvswork textfile.c v1.2 &&\n> -    check_file cvswork t3 v1.2 &&\n> -    check_file cvswork adir/afile v1.2 &&\n> -    check_file cvswork adir/a3file v1.2 &&\n> -    check_file cvswork adir/bdir/bfile v1.2 &&\n> -    check_file cvswork adir/bdir/b3file v1.2 &&\n> -    check_file cvswork cdir/cfile v1.2 &&\n> -    check_end_tree cvswork\n> +\t\t( cd cvswork &&\n> +\t\t\tcvs -f up -d ) >cvs.log 2>&1 &&\n> +\t\tcheck_start_tree cvswork &&\n> +\t\tcheck_file cvswork textfile.c v1.2 &&\n> +\t\tcheck_file cvswork t3 v1.2 &&\n> +\t\tcheck_file cvswork adir/afile v1.2 &&\n> +\t\tcheck_file cvswork adir/a3file v1.2 &&\n> +\t\tcheck_file cvswork adir/bdir/bfile v1.2 &&\n> +\t\tcheck_file cvswork adir/bdir/b3file v1.2 &&\n> +\t\tcheck_file cvswork cdir/cfile v1.2 &&\n> +\t\tcheck_end_tree cvswork\n>  '\n>  \n>  # update to another version:\n>  test_expect_success 'cvs up -r v1' '\n> -    ( cd cvswork &&\n> -      cvs -f up -r v1 ) >cvs.log 2>&1 &&\n> -    check_start_tree cvswork &&\n> -    check_file cvswork textfile.c v1 &&\n> -    check_file cvswork t2 v1 &&\n> -    check_file cvswork adir/afile v1 &&\n> -    check_file cvswork adir/a2file v1 &&\n> -    check_file cvswork adir/bdir/bfile v1 &&\n> -    check_file cvswork adir/bdir/b2file v1 &&\n> -    check_end_tree cvswork\n> +\t\t( cd cvswork &&\n> +\t\t\tcvs -f up -r v1 ) >cvs.log 2>&1 &&\n> +\t\tcheck_start_tree cvswork &&\n> +\t\tcheck_file cvswork textfile.c v1 &&\n> +\t\tcheck_file cvswork t2 v1 &&\n> +\t\tcheck_file cvswork adir/afile v1 &&\n> +\t\tcheck_file cvswork adir/a2file v1 &&\n> +\t\tcheck_file cvswork adir/bdir/bfile v1 &&\n> +\t\tcheck_file cvswork adir/bdir/b2file v1 &&\n> +\t\tcheck_end_tree cvswork\n>  '\n>  \n>  test_expect_success 'cvs up' '\n> -    ( cd cvswork &&\n> -      cvs -f up ) >cvs.log 2>&1 &&\n> -    check_start_tree cvswork &&\n> -    check_file cvswork textfile.c v1 &&\n> -    check_file cvswork t2 v1 &&\n> -    check_file cvswork adir/afile v1 &&\n> -    check_file cvswork adir/a2file v1 &&\n> -    check_file cvswork adir/bdir/bfile v1 &&\n> -    check_file cvswork adir/bdir/b2file v1 &&\n> -    check_end_tree cvswork\n> +\t\t( cd cvswork &&\n> +\t\t\tcvs -f up ) >cvs.log 2>&1 &&\n> +\t\tcheck_start_tree cvswork &&\n> +\t\tcheck_file cvswork textfile.c v1 &&\n> +\t\tcheck_file cvswork t2 v1 &&\n> +\t\tcheck_file cvswork adir/afile v1 &&\n> +\t\tcheck_file cvswork adir/a2file v1 &&\n> +\t\tcheck_file cvswork adir/bdir/bfile v1 &&\n> +\t\tcheck_file cvswork adir/bdir/b2file v1 &&\n> +\t\tcheck_end_tree cvswork\n>  '\n>  \n>  test_expect_success 'cvs up (again; check CVS/Tag files)' '\n> -    ( cd cvswork &&\n> -      cvs -f up -d ) >cvs.log 2>&1 &&\n> -    check_start_tree cvswork &&\n> -    check_file cvswork textfile.c v1 &&\n> -    check_file cvswork t2 v1 &&\n> -    check_file cvswork adir/afile v1 &&\n> -    check_file cvswork adir/a2file v1 &&\n> -    check_file cvswork adir/bdir/bfile v1 &&\n> -    check_file cvswork adir/bdir/b2file v1 &&\n> -    check_end_tree cvswork\n> +\t\t( cd cvswork &&\n> +\t\t\tcvs -f up -d ) >cvs.log 2>&1 &&\n> +\t\tcheck_start_tree cvswork &&\n> +\t\tcheck_file cvswork textfile.c v1 &&\n> +\t\tcheck_file cvswork t2 v1 &&\n> +\t\tcheck_file cvswork adir/afile v1 &&\n> +\t\tcheck_file cvswork adir/a2file v1 &&\n> +\t\tcheck_file cvswork adir/bdir/bfile v1 &&\n> +\t\tcheck_file cvswork adir/bdir/b2file v1 &&\n> +\t\tcheck_end_tree cvswork\n>  '\n>  \n>  test_expect_success 'setup simple b2' '\n> -    git branch b2 v1 &&\n> -    git push --tags gitcvs.git b2:b2\n> +\t\tgit branch b2 v1 &&\n> +\t\tgit push --tags gitcvs.git b2:b2\n>  '\n>  \n>  test_expect_success 'cvs co b2 [into cvswork2]' '\n> -    cvs -f co -r b2 -d cvswork2 master >cvs.log 2>&1 &&\n> -    check_start_tree cvswork &&\n> -    check_file cvswork textfile.c v1 &&\n> -    check_file cvswork t2 v1 &&\n> -    check_file cvswork adir/afile v1 &&\n> -    check_file cvswork adir/a2file v1 &&\n> -    check_file cvswork adir/bdir/bfile v1 &&\n> -    check_file cvswork adir/bdir/b2file v1 &&\n> -    check_end_tree cvswork\n> +\t\tcvs -f co -r b2 -d cvswork2 master >cvs.log 2>&1 &&\n> +\t\tcheck_start_tree cvswork &&\n> +\t\tcheck_file cvswork textfile.c v1 &&\n> +\t\tcheck_file cvswork t2 v1 &&\n> +\t\tcheck_file cvswork adir/afile v1 &&\n> +\t\tcheck_file cvswork adir/a2file v1 &&\n> +\t\tcheck_file cvswork adir/bdir/bfile v1 &&\n> +\t\tcheck_file cvswork adir/bdir/b2file v1 &&\n> +\t\tcheck_end_tree cvswork\n>  '\n>  \n>  test_expect_success 'root dir edit [cvswork2]' '\n> -    ( cd cvswork2 &&\n> -      echo \"Line 2\" >> textfile.c &&\n> -      test_must_fail cvs -f diff -u >\"$WORKDIR/cvsEdit1.diff\" &&\n> -      cvs -f commit -m \"edit textfile.c\" textfile.c\n> -    ) >cvsEdit1.log 2>&1\n> +\t\t( cd cvswork2 &&\n> +\t\t\techo \"Line 2\" >> textfile.c &&\n> +\t\t\ttest_must_fail cvs -f diff -u >\"$WORKDIR/cvsEdit1.diff\" &&\n> +\t\t\tcvs -f commit -m \"edit textfile.c\" textfile.c\n> +\t\t) >cvsEdit1.log 2>&1\n>  '\n>  \n>  test_expect_success 'root dir rm file [cvswork2]' '\n> -    ( cd cvswork2 &&\n> -      cvs -f rm -f t2 &&\n> -      cvs -f diff -u > ../cvsEdit2-empty.diff &&\n> -      test_must_fail cvs -f diff -N -u >\"$WORKDIR/cvsEdit2-N.diff\" &&\n> -      cvs -f commit -m \"rm t2\"\n> -    ) > cvsEdit2.log 2>&1\n> +\t\t( cd cvswork2 &&\n> +\t\t\tcvs -f rm -f t2 &&\n> +\t\t\tcvs -f diff -u > ../cvsEdit2-empty.diff &&\n> +\t\t\ttest_must_fail cvs -f diff -N -u >\"$WORKDIR/cvsEdit2-N.diff\" &&\n> +\t\t\tcvs -f commit -m \"rm t2\"\n> +\t\t) > cvsEdit2.log 2>&1\n>  '\n>  \n>  test_expect_success 'subdir edit/add/rm files [cvswork2' '\n> -    ( cd cvswork2 &&\n> -      sed -i -e \"s/line 1/line 1 (v2)/\" adir/bdir/bfile &&\n> -      rm adir/bdir/b2file &&\n> -      cd adir &&\n> -      cvs -f rm bdir/b2file &&\n> -      echo \"4th file\" > bdir/b4file &&\n> -      cvs -f add bdir/b4file &&\n> -      test_must_fail cvs -f diff -N -u >\"$WORKDIR/cvsEdit3.diff\" &&\n> -      git fetch gitcvs.git b2:b2 &&\n> -      ( cd .. &&\n> +\t\t( cd cvswork2 &&\n> +\t\t\tsed -e \"s/line 1/line 1 (v2)/\" adir/bdir/bfile >adir/bdir/bfileNEW &&\n> +\t\t\tmv -f adir/bdir/bfileNEW adir/bdir/bfile &&\n> +\t\t\trm adir/bdir/b2file &&\n> +\t\t\tcd adir &&\n> +\t\t\tcvs -f rm bdir/b2file &&\n> +\t\t\techo \"4th file\" > bdir/b4file &&\n> +\t\t\tcvs -f add bdir/b4file &&\n> +\t\t\ttest_must_fail cvs -f diff -N -u >\"$WORKDIR/cvsEdit3.diff\" &&\n> +\t\t\tgit fetch gitcvs.git b2:b2 &&\n> +\t\t\t( cd .. &&\n>  \ttest_must_fail cvs -f diff -u -N -r v1.2 >\"$WORKDIR/cvsEdit3-v1.2.diff\" &&\n>  \ttest_must_fail cvs -f diff -u -N -r v1.2 -r v1 >\"$WORKDIR/cvsEdit3-v1.2-v1.diff\"\n> -      ) &&\n> -      cvs -f commit -m \"various add/rm/edit\"\n> -    ) >cvs.log 2>&1\n> +\t\t\t) &&\n> +\t\t\tcvs -f commit -m \"various add/rm/edit\"\n> +\t\t) >cvs.log 2>&1\n>  '\n>  \n>  test_expect_success 'validate result of edits [cvswork2]' '\n> -    git fetch gitcvs.git b2:b2 &&\n> -    git tag v2 b2 &&\n> -    git push --tags gitcvs.git b2:b2 &&\n> -    check_start_tree cvswork2 &&\n> -    check_file cvswork2 textfile.c v2 &&\n> -    check_file cvswork2 adir/afile v2 &&\n> -    check_file cvswork2 adir/a2file v2 &&\n> -    check_file cvswork2 adir/bdir/bfile v2 &&\n> -    check_file cvswork2 adir/bdir/b4file v2 &&\n> -    check_end_full_tree cvswork2 v2\n> +\t\tgit fetch gitcvs.git b2:b2 &&\n> +\t\tgit tag v2 b2 &&\n> +\t\tgit push --tags gitcvs.git b2:b2 &&\n> +\t\tcheck_start_tree cvswork2 &&\n> +\t\tcheck_file cvswork2 textfile.c v2 &&\n> +\t\tcheck_file cvswork2 adir/afile v2 &&\n> +\t\tcheck_file cvswork2 adir/a2file v2 &&\n> +\t\tcheck_file cvswork2 adir/bdir/bfile v2 &&\n> +\t\tcheck_file cvswork2 adir/bdir/b4file v2 &&\n> +\t\tcheck_end_full_tree cvswork2 v2\n>  '\n>  \n>  test_expect_success 'validate basic diffs saved during above cvswork2 edits' '\n> -    test $(grep Index: cvsEdit1.diff | wc -l) = 1 &&\n> -    test ! -s cvsEdit2-empty.diff &&\n> -    test $(grep Index: cvsEdit2-N.diff | wc -l) = 1 &&\n> -    test $(grep Index: cvsEdit3.diff | wc -l) = 3 &&\n> -    rm -rf diffSandbox &&\n> -    git clone -q -n . diffSandbox &&\n> -    ( cd diffSandbox &&\n> -      git checkout v1 &&\n> -      git apply -p0 --index <\"$WORKDIR/cvsEdit1.diff\" &&\n> -      git apply -p0 --index <\"$WORKDIR/cvsEdit2-N.diff\" &&\n> -      git apply -p0 --directory=adir --index <\"$WORKDIR/cvsEdit3.diff\" &&\n> -      git diff --exit-code v2 ) >\"check_diff_apply.out\" 2>&1\n> +\t\ttest $(grep Index: cvsEdit1.diff | wc -l) = 1 &&\n> +\t\ttest ! -s cvsEdit2-empty.diff &&\n> +\t\ttest $(grep Index: cvsEdit2-N.diff | wc -l) = 1 &&\n> +\t\ttest $(grep Index: cvsEdit3.diff | wc -l) = 3 &&\n> +\t\trm -rf diffSandbox &&\n> +\t\tgit clone -q -n . diffSandbox &&\n> +\t\t( cd diffSandbox &&\n> +\t\t\tgit checkout v1 &&\n> +\t\t\tgit apply -p0 --index <\"$WORKDIR/cvsEdit1.diff\" &&\n> +\t\t\tgit apply -p0 --index <\"$WORKDIR/cvsEdit2-N.diff\" &&\n> +\t\t\tgit apply -p0 --directory=adir --index <\"$WORKDIR/cvsEdit3.diff\" &&\n> +\t\t\tgit diff --exit-code v2 ) >\"check_diff_apply.out\" 2>&1\n>  '\n>  \n>  test_expect_success 'validate v1.2 diff saved during last cvswork2 edit' '\n> -    test $(grep Index: cvsEdit3-v1.2.diff | wc -l) = 9 &&\n> -    check_diff cvsEdit3-v1.2.diff v1.2 v2\n> +\t\ttest $(grep Index: cvsEdit3-v1.2.diff | wc -l) = 9 &&\n> +\t\tcheck_diff cvsEdit3-v1.2.diff v1.2 v2\n>  '\n>  \n>  test_expect_success 'validate v1.2 v1 diff saved during last cvswork2 edit' '\n> -    test $(grep Index: cvsEdit3-v1.2-v1.diff | wc -l) = 9 &&\n> -    check_diff cvsEdit3-v1.2-v1.diff v1.2 v1\n> +\t\ttest $(grep Index: cvsEdit3-v1.2-v1.diff | wc -l) = 9 &&\n> +\t\tcheck_diff cvsEdit3-v1.2-v1.diff v1.2 v1\n>  '\n>  \n>  test_expect_success 'cvs up [cvswork2]' '\n> -    ( cd cvswork2 &&\n> -      cvs -f up ) >cvs.log 2>&1 &&\n> -    check_start_tree cvswork2 &&\n> -    check_file cvswork2 textfile.c v2 &&\n> -    check_file cvswork2 adir/afile v2 &&\n> -    check_file cvswork2 adir/a2file v2 &&\n> -    check_file cvswork2 adir/bdir/bfile v2 &&\n> -    check_file cvswork2 adir/bdir/b4file v2 &&\n> -    check_end_full_tree cvswork2 v2\n> +\t\t( cd cvswork2 &&\n> +\t\t\tcvs -f up ) >cvs.log 2>&1 &&\n> +\t\tcheck_start_tree cvswork2 &&\n> +\t\tcheck_file cvswork2 textfile.c v2 &&\n> +\t\tcheck_file cvswork2 adir/afile v2 &&\n> +\t\tcheck_file cvswork2 adir/a2file v2 &&\n> +\t\tcheck_file cvswork2 adir/bdir/bfile v2 &&\n> +\t\tcheck_file cvswork2 adir/bdir/b4file v2 &&\n> +\t\tcheck_end_full_tree cvswork2 v2\n>  '\n>  \n>  test_expect_success 'cvs up -r b2 [back to cvswork]' '\n> -    ( cd cvswork &&\n> -      cvs -f up -r b2 ) >cvs.log 2>&1 &&\n> -    check_start_tree cvswork &&\n> -    check_file cvswork textfile.c v2 &&\n> -    check_file cvswork adir/afile v2 &&\n> -    check_file cvswork adir/a2file v2 &&\n> -    check_file cvswork adir/bdir/bfile v2 &&\n> -    check_file cvswork adir/bdir/b4file v2 &&\n> -    check_end_full_tree cvswork v2\n> +\t\t( cd cvswork &&\n> +\t\t\tcvs -f up -r b2 ) >cvs.log 2>&1 &&\n> +\t\tcheck_start_tree cvswork &&\n> +\t\tcheck_file cvswork textfile.c v2 &&\n> +\t\tcheck_file cvswork adir/afile v2 &&\n> +\t\tcheck_file cvswork adir/a2file v2 &&\n> +\t\tcheck_file cvswork adir/bdir/bfile v2 &&\n> +\t\tcheck_file cvswork adir/bdir/b4file v2 &&\n> +\t\tcheck_end_full_tree cvswork v2\n>  '\n>  \n>  test_expect_success 'cvs up -r b1' '\n> -    ( cd cvswork &&\n> -      cvs -f up -r b1 ) >cvs.log 2>&1 &&\n> -    check_start_tree cvswork &&\n> -    check_file cvswork textfile.c v1.2 &&\n> -    check_file cvswork t3 v1.2 &&\n> -    check_file cvswork adir/afile v1.2 &&\n> -    check_file cvswork adir/a3file v1.2 &&\n> -    check_file cvswork adir/bdir/bfile v1.2 &&\n> -    check_file cvswork adir/bdir/b3file v1.2 &&\n> -    check_file cvswork cdir/cfile v1.2 &&\n> -    check_end_full_tree cvswork v1.2\n> +\t\t( cd cvswork &&\n> +\t\t\tcvs -f up -r b1 ) >cvs.log 2>&1 &&\n> +\t\tcheck_start_tree cvswork &&\n> +\t\tcheck_file cvswork textfile.c v1.2 &&\n> +\t\tcheck_file cvswork t3 v1.2 &&\n> +\t\tcheck_file cvswork adir/afile v1.2 &&\n> +\t\tcheck_file cvswork adir/a3file v1.2 &&\n> +\t\tcheck_file cvswork adir/bdir/bfile v1.2 &&\n> +\t\tcheck_file cvswork adir/bdir/b3file v1.2 &&\n> +\t\tcheck_file cvswork cdir/cfile v1.2 &&\n> +\t\tcheck_end_full_tree cvswork v1.2\n>  '\n>  \n>  test_expect_success 'cvs up -A' '\n> -    ( cd cvswork &&\n> -      cvs -f up -A ) >cvs.log 2>&1 &&\n> -    check_start_tree cvswork &&\n> -    check_file cvswork textfile.c v1 &&\n> -    check_file cvswork t2 v1 &&\n> -    check_file cvswork adir/afile v1 &&\n> -    check_file cvswork adir/a2file v1 &&\n> -    check_file cvswork adir/bdir/bfile v1 &&\n> -    check_file cvswork adir/bdir/b2file v1 &&\n> -    check_end_full_tree cvswork v1\n> +\t\t( cd cvswork &&\n> +\t\t\tcvs -f up -A ) >cvs.log 2>&1 &&\n> +\t\tcheck_start_tree cvswork &&\n> +\t\tcheck_file cvswork textfile.c v1 &&\n> +\t\tcheck_file cvswork t2 v1 &&\n> +\t\tcheck_file cvswork adir/afile v1 &&\n> +\t\tcheck_file cvswork adir/a2file v1 &&\n> +\t\tcheck_file cvswork adir/bdir/bfile v1 &&\n> +\t\tcheck_file cvswork adir/bdir/b2file v1 &&\n> +\t\tcheck_end_full_tree cvswork v1\n>  '\n>  \n>  test_expect_success 'cvs up (check CVS/Tag files)' '\n> -    ( cd cvswork &&\n> -      cvs -f up ) >cvs.log 2>&1 &&\n> -    check_start_tree cvswork &&\n> -    check_file cvswork textfile.c v1 &&\n> -    check_file cvswork t2 v1 &&\n> -    check_file cvswork adir/afile v1 &&\n> -    check_file cvswork adir/a2file v1 &&\n> -    check_file cvswork adir/bdir/bfile v1 &&\n> -    check_file cvswork adir/bdir/b2file v1 &&\n> -    check_end_full_tree cvswork v1\n> +\t\t( cd cvswork &&\n> +\t\t\tcvs -f up ) >cvs.log 2>&1 &&\n> +\t\tcheck_start_tree cvswork &&\n> +\t\tcheck_file cvswork textfile.c v1 &&\n> +\t\tcheck_file cvswork t2 v1 &&\n> +\t\tcheck_file cvswork adir/afile v1 &&\n> +\t\tcheck_file cvswork adir/a2file v1 &&\n> +\t\tcheck_file cvswork adir/bdir/bfile v1 &&\n> +\t\tcheck_file cvswork adir/bdir/b2file v1 &&\n> +\t\tcheck_end_full_tree cvswork v1\n>  '\n>  \n>  # This is not really legal CVS, but it seems to work anyway:\n>  test_expect_success 'cvs up -r heads/b1' '\n> -    ( cd cvswork &&\n> -      cvs -f up -r heads/b1 ) >cvs.log 2>&1 &&\n> -    check_start_tree cvswork &&\n> -    check_file cvswork textfile.c v1.2 &&\n> -    check_file cvswork t3 v1.2 &&\n> -    check_file cvswork adir/afile v1.2 &&\n> -    check_file cvswork adir/a3file v1.2 &&\n> -    check_file cvswork adir/bdir/bfile v1.2 &&\n> -    check_file cvswork adir/bdir/b3file v1.2 &&\n> -    check_file cvswork cdir/cfile v1.2 &&\n> -    check_end_full_tree cvswork v1.2\n> +\t\t( cd cvswork &&\n> +\t\t\tcvs -f up -r heads/b1 ) >cvs.log 2>&1 &&\n> +\t\tcheck_start_tree cvswork &&\n> +\t\tcheck_file cvswork textfile.c v1.2 &&\n> +\t\tcheck_file cvswork t3 v1.2 &&\n> +\t\tcheck_file cvswork adir/afile v1.2 &&\n> +\t\tcheck_file cvswork adir/a3file v1.2 &&\n> +\t\tcheck_file cvswork adir/bdir/bfile v1.2 &&\n> +\t\tcheck_file cvswork adir/bdir/b3file v1.2 &&\n> +\t\tcheck_file cvswork cdir/cfile v1.2 &&\n> +\t\tcheck_end_full_tree cvswork v1.2\n>  '\n>  \n>  # But this should work even if CVS client checks -r more carefully:\n>  test_expect_success 'cvs up -r heads_-s-b2 (cvsserver escape mechanism)' '\n> -    ( cd cvswork &&\n> -      cvs -f up -r heads_-s-b2 ) >cvs.log 2>&1 &&\n> -    check_start_tree cvswork &&\n> -    check_file cvswork textfile.c v2 &&\n> -    check_file cvswork adir/afile v2 &&\n> -    check_file cvswork adir/a2file v2 &&\n> -    check_file cvswork adir/bdir/bfile v2 &&\n> -    check_file cvswork adir/bdir/b4file v2 &&\n> -    check_end_full_tree cvswork v2\n> +\t\t( cd cvswork &&\n> +\t\t\tcvs -f up -r heads_-s-b2 ) >cvs.log 2>&1 &&\n> +\t\tcheck_start_tree cvswork &&\n> +\t\tcheck_file cvswork textfile.c v2 &&\n> +\t\tcheck_file cvswork adir/afile v2 &&\n> +\t\tcheck_file cvswork adir/a2file v2 &&\n> +\t\tcheck_file cvswork adir/bdir/bfile v2 &&\n> +\t\tcheck_file cvswork adir/bdir/b4file v2 &&\n> +\t\tcheck_end_full_tree cvswork v2\n>  '\n>  \n>  v1hash=$(git rev-parse v1)\n>  test_expect_success 'cvs up -r $(git rev-parse v1)' '\n> -    test -n \"$v1hash\" &&\n> -    ( cd cvswork &&\n> -      cvs -f up -r \"$v1hash\" ) >cvs.log 2>&1 &&\n> -    check_start_tree cvswork &&\n> -    check_file cvswork textfile.c v1 &&\n> -    check_file cvswork t2 v1 &&\n> -    check_file cvswork adir/afile v1 &&\n> -    check_file cvswork adir/a2file v1 &&\n> -    check_file cvswork adir/bdir/bfile v1 &&\n> -    check_file cvswork adir/bdir/b2file v1 &&\n> -    check_end_full_tree cvswork v1\n> +\t\ttest -n \"$v1hash\" &&\n> +\t\t( cd cvswork &&\n> +\t\t\tcvs -f up -r \"$v1hash\" ) >cvs.log 2>&1 &&\n> +\t\tcheck_start_tree cvswork &&\n> +\t\tcheck_file cvswork textfile.c v1 &&\n> +\t\tcheck_file cvswork t2 v1 &&\n> +\t\tcheck_file cvswork adir/afile v1 &&\n> +\t\tcheck_file cvswork adir/a2file v1 &&\n> +\t\tcheck_file cvswork adir/bdir/bfile v1 &&\n> +\t\tcheck_file cvswork adir/bdir/b2file v1 &&\n> +\t\tcheck_end_full_tree cvswork v1\n>  '\n>  \n>  test_expect_success 'cvs diff -r v1 -u' '\n> -    ( cd cvswork &&\n> -      cvs -f diff -r v1 -u ) >cvsDiff.out 2>cvs.log &&\n> -    test ! -s cvsDiff.out &&\n> -    test ! -s cvs.log\n> +\t\t( cd cvswork &&\n> +\t\t\tcvs -f diff -r v1 -u ) >cvsDiff.out 2>cvs.log &&\n> +\t\ttest ! -s cvsDiff.out &&\n> +\t\ttest ! -s cvs.log\n>  '\n>  \n>  test_expect_success 'cvs diff -N -r v2 -u' '\n> -    ( cd cvswork &&\n> -      test_must_fail cvs -f diff -N -r v2 -u ) >cvsDiff.out 2>cvs.log &&\n> -    test ! -s cvs.log &&\n> -    test -s cvsDiff.out &&\n> -    check_diff cvsDiff.out v2 v1 > check_diff.out 2>&1\n> +\t\t( cd cvswork &&\n> +\t\t\ttest_must_fail cvs -f diff -N -r v2 -u ) >cvsDiff.out 2>cvs.log &&\n> +\t\ttest ! -s cvs.log &&\n> +\t\ttest -s cvsDiff.out &&\n> +\t\tcheck_diff cvsDiff.out v2 v1 > check_diff.out 2>&1\n>  '\n>  \n>  test_expect_success 'cvs diff -N -r v2 -r v1.2' '\n> -    ( cd cvswork &&\n> -      test_must_fail cvs -f diff -N -r v2 -r v1.2 -u ) >cvsDiff.out 2>cvs.log &&\n> -    test ! -s cvs.log &&\n> -    test -s cvsDiff.out &&\n> -    check_diff cvsDiff.out v2 v1.2 > check_diff.out 2>&1\n> +\t\t( cd cvswork &&\n> +\t\t\ttest_must_fail cvs -f diff -N -r v2 -r v1.2 -u ) >cvsDiff.out 2>cvs.log &&\n> +\t\ttest ! -s cvs.log &&\n> +\t\ttest -s cvsDiff.out &&\n> +\t\tcheck_diff cvsDiff.out v2 v1.2 > check_diff.out 2>&1\n>  '\n>  \n>  test_expect_success 'apply early [cvswork3] diff to b3' '\n> -    git clone -q . gitwork3 &&\n> -    ( cd gitwork3 &&\n> -      git checkout -b b3 v1 &&\n> -      git apply -p0 --index <\"$WORKDIR/cvswork3edit.diff\" &&\n> -      git commit -m \"cvswork3 edits applied\" ) &&\n> -    git fetch gitwork3 b3:b3 &&\n> -    git tag v3 b3\n> +\t\tgit clone -q . gitwork3 &&\n> +\t\t( cd gitwork3 &&\n> +\t\t\tgit checkout -b b3 v1 &&\n> +\t\t\tgit apply -p0 --index <\"$WORKDIR/cvswork3edit.diff\" &&\n> +\t\t\tgit commit -m \"cvswork3 edits applied\" ) &&\n> +\t\tgit fetch gitwork3 b3:b3 &&\n> +\t\tgit tag v3 b3\n>  '\n>  \n>  test_expect_success 'check [cvswork3] diff' '\n> -    ( cd cvswork3 &&\n> -      test_must_fail cvs -f diff -N -u ) >\"$WORKDIR/cvsDiff.out\" 2>cvs.log &&\n> -    test ! -s cvs.log &&\n> -    test -s cvsDiff.out &&\n> -    test $(grep Index: cvsDiff.out | wc -l) = 3 &&\n> -    test_cmp cvsDiff.out cvswork3edit.diff &&\n> -    check_diff cvsDiff.out v1 v3 > check_diff.out 2>&1\n> +\t\t( cd cvswork3 &&\n> +\t\t\ttest_must_fail cvs -f diff -N -u ) >\"$WORKDIR/cvsDiff.out\" 2>cvs.log &&\n> +\t\ttest ! -s cvs.log &&\n> +\t\ttest -s cvsDiff.out &&\n> +\t\ttest $(grep Index: cvsDiff.out | wc -l) = 3 &&\n> +\t\ttest_cmp cvsDiff.out cvswork3edit.diff &&\n> +\t\tcheck_diff cvsDiff.out v1 v3 > check_diff.out 2>&1\n>  '\n>  \n>  test_expect_success 'merge early [cvswork3] b3 with b1' '\n> -    ( cd gitwork3 &&\n> -      git merge \"message\" HEAD b1 )\n> -    git fetch gitwork3 b3:b3 &&\n> -    git tag v3merged b3 &&\n> -    git push --tags gitcvs.git b3:b3\n> +\t\t( cd gitwork3 &&\n> +\t\t\tgit merge \"message\" HEAD b1 )\n> +\t\tgit fetch gitwork3 b3:b3 &&\n> +\t\tgit tag v3merged b3 &&\n> +\t\tgit push --tags gitcvs.git b3:b3\n>  '\n>  \n>  # This test would fail if cvsserver properly created a \".#afile\"* file\n>  # for the merge.\n>  # TODO: Validate that the .# file was saved properly, and then\n> -#   delete/ignore it when checking the tree.\n> +#\t\tdelete/ignore it when checking the tree.\n>  test_expect_success 'cvs up dirty [cvswork3]' '\n> -    ( cd cvswork3 &&\n> -      cvs -f up &&\n> -      test_must_fail cvs -f diff -N -u >\"$WORKDIR/cvsDiff.out\" ) >cvs.log 2>&1 &&\n> -    test -s cvsDiff.out &&\n> -    test $(grep Index: cvsDiff.out | wc -l) = 2\n> -    check_start_tree cvswork3 &&\n> -    check_file cvswork3 textfile.c v3merged &&\n> -    check_file cvswork3 t3 v3merged &&\n> -    check_file cvswork3 adir/afile v3merged &&\n> -    check_file cvswork3 adir/a3file v3merged &&\n> -    check_file cvswork3 adir/afile5 v3merged &&\n> -    check_file cvswork3 adir/bdir/bfile v3merged &&\n> -    check_file cvswork3 adir/bdir/b3file v3merged &&\n> -    check_file cvswork3 cdir/cfile v3merged &&\n> -    check_end_full_tree cvswork3 v3merged\n> +\t\t( cd cvswork3 &&\n> +\t\t\tcvs -f up &&\n> +\t\t\ttest_must_fail cvs -f diff -N -u >\"$WORKDIR/cvsDiff.out\" ) >cvs.log 2>&1 &&\n> +\t\ttest -s cvsDiff.out &&\n> +\t\ttest $(grep Index: cvsDiff.out | wc -l) = 2\n> +\t\tcheck_start_tree cvswork3 &&\n> +\t\tcheck_file cvswork3 textfile.c v3merged &&\n> +\t\tcheck_file cvswork3 t3 v3merged &&\n> +\t\tcheck_file cvswork3 adir/afile v3merged &&\n> +\t\tcheck_file cvswork3 adir/a3file v3merged &&\n> +\t\tcheck_file cvswork3 adir/afile5 v3merged &&\n> +\t\tcheck_file cvswork3 adir/bdir/bfile v3merged &&\n> +\t\tcheck_file cvswork3 adir/bdir/b3file v3merged &&\n> +\t\tcheck_file cvswork3 cdir/cfile v3merged &&\n> +\t\tcheck_end_full_tree cvswork3 v3merged\n>  '\n>  \n>  # TODO: test cvs status\n>  \n>  test_expect_success 'cvs commit [cvswork3' '\n> -    ( cd cvswork3 &&\n> -      cvs -f commit -m \"dirty sandbox after auto-merge\"\n> -    ) > cvs.log 2>&1 &&\n> -    check_start_tree cvswork3 &&\n> -    check_file cvswork3 textfile.c v3merged &&\n> -    check_file cvswork3 t3 v3merged &&\n> -    check_file cvswork3 adir/afile v3merged &&\n> -    check_file cvswork3 adir/a3file v3merged &&\n> -    check_file cvswork3 adir/afile5 v3merged &&\n> -    check_file cvswork3 adir/bdir/bfile v3merged &&\n> -    check_file cvswork3 adir/bdir/b3file v3merged &&\n> -    check_file cvswork3 cdir/cfile v3merged &&\n> -    check_end_full_tree cvswork3 v3merged &&\n> -    git fetch gitcvs.git b3:b4 &&\n> -    git tag v4.1 b4 &&\n> -    git diff --exit-code v4.1 v3merged > check_diff_apply.out 2>&1\n> +\t\t( cd cvswork3 &&\n> +\t\t\tcvs -f commit -m \"dirty sandbox after auto-merge\"\n> +\t\t) > cvs.log 2>&1 &&\n> +\t\tcheck_start_tree cvswork3 &&\n> +\t\tcheck_file cvswork3 textfile.c v3merged &&\n> +\t\tcheck_file cvswork3 t3 v3merged &&\n> +\t\tcheck_file cvswork3 adir/afile v3merged &&\n> +\t\tcheck_file cvswork3 adir/a3file v3merged &&\n> +\t\tcheck_file cvswork3 adir/afile5 v3merged &&\n> +\t\tcheck_file cvswork3 adir/bdir/bfile v3merged &&\n> +\t\tcheck_file cvswork3 adir/bdir/b3file v3merged &&\n> +\t\tcheck_file cvswork3 cdir/cfile v3merged &&\n> +\t\tcheck_end_full_tree cvswork3 v3merged &&\n> +\t\tgit fetch gitcvs.git b3:b4 &&\n> +\t\tgit tag v4.1 b4 &&\n> +\t\tgit diff --exit-code v4.1 v3merged > check_diff_apply.out 2>&1\n>  '\n>  \n>  test_done\n"}]}