Merge branch 'jc/test-modernization-2'

Test style updates.

* jc/test-modernization-2:
  t9400-git-cvsserver-server: modernize test format
  t9200-git-cvsexportcommit: modernize test format
  t9104-git-svn-follow-parent: modernize test format
  t9100-git-svn-basic: modernize test format
  t7700-repack: modernize test format
  t7600-merge: modernize test format
  t7508-status: modernize test format
  t7201-co: modernize test format
  t7111-reset-table: modernize test format
  t7110-reset-merge: modernize test format
This commit is contained in:
Junio C Hamano
2023-06-20 15:53:12 -07:00
10 changed files with 741 additions and 717 deletions

View File

@@ -9,17 +9,17 @@ TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
printf "line %d\n" 1 2 3 >file1 &&
cat file1 >file2 &&
git add file1 file2 &&
test_tick &&
git commit -m "Initial commit" &&
git tag initial &&
echo line 4 >>file1 &&
cat file1 >file2 &&
test_tick &&
git commit -m "add line 4 to file1" file1 &&
git tag second
printf "line %d\n" 1 2 3 >file1 &&
cat file1 >file2 &&
git add file1 file2 &&
test_tick &&
git commit -m "Initial commit" &&
git tag initial &&
echo line 4 >>file1 &&
cat file1 >file2 &&
test_tick &&
git commit -m "add line 4 to file1" file1 &&
git tag second
'
# The next test will test the following:
@@ -29,19 +29,19 @@ test_expect_success setup '
# file1: C C C D --merge D D D
# file2: C D D D --merge C D D
test_expect_success 'reset --merge is ok with changes in file it does not touch' '
git reset --merge HEAD^ &&
! grep 4 file1 &&
grep 4 file2 &&
test "$(git rev-parse HEAD)" = "$(git rev-parse initial)" &&
test -z "$(git diff --cached)"
git reset --merge HEAD^ &&
! grep 4 file1 &&
grep 4 file2 &&
test "$(git rev-parse HEAD)" = "$(git rev-parse initial)" &&
test -z "$(git diff --cached)"
'
test_expect_success 'reset --merge is ok when switching back' '
git reset --merge second &&
grep 4 file1 &&
grep 4 file2 &&
test "$(git rev-parse HEAD)" = "$(git rev-parse second)" &&
test -z "$(git diff --cached)"
git reset --merge second &&
grep 4 file1 &&
grep 4 file2 &&
test "$(git rev-parse HEAD)" = "$(git rev-parse second)" &&
test -z "$(git diff --cached)"
'
# The next test will test the following:
@@ -51,21 +51,21 @@ test_expect_success 'reset --merge is ok when switching back' '
# file1: C C C D --keep D D D
# file2: C D D D --keep C D D
test_expect_success 'reset --keep is ok with changes in file it does not touch' '
git reset --hard second &&
cat file1 >file2 &&
git reset --keep HEAD^ &&
! grep 4 file1 &&
grep 4 file2 &&
test "$(git rev-parse HEAD)" = "$(git rev-parse initial)" &&
test -z "$(git diff --cached)"
git reset --hard second &&
cat file1 >file2 &&
git reset --keep HEAD^ &&
! grep 4 file1 &&
grep 4 file2 &&
test "$(git rev-parse HEAD)" = "$(git rev-parse initial)" &&
test -z "$(git diff --cached)"
'
test_expect_success 'reset --keep is ok when switching back' '
git reset --keep second &&
grep 4 file1 &&
grep 4 file2 &&
test "$(git rev-parse HEAD)" = "$(git rev-parse second)" &&
test -z "$(git diff --cached)"
git reset --keep second &&
grep 4 file1 &&
grep 4 file2 &&
test "$(git rev-parse HEAD)" = "$(git rev-parse second)" &&
test -z "$(git diff --cached)"
'
# The next test will test the following:
@@ -75,28 +75,28 @@ test_expect_success 'reset --keep is ok when switching back' '
# file1: B B C D --merge D D D
# file2: C D D D --merge C D D
test_expect_success 'reset --merge discards changes added to index (1)' '
git reset --hard second &&
cat file1 >file2 &&
echo "line 5" >> file1 &&
git add file1 &&
git reset --merge HEAD^ &&
! grep 4 file1 &&
! grep 5 file1 &&
grep 4 file2 &&
test "$(git rev-parse HEAD)" = "$(git rev-parse initial)" &&
test -z "$(git diff --cached)"
git reset --hard second &&
cat file1 >file2 &&
echo "line 5" >> file1 &&
git add file1 &&
git reset --merge HEAD^ &&
! grep 4 file1 &&
! grep 5 file1 &&
grep 4 file2 &&
test "$(git rev-parse HEAD)" = "$(git rev-parse initial)" &&
test -z "$(git diff --cached)"
'
test_expect_success 'reset --merge is ok again when switching back (1)' '
git reset --hard initial &&
echo "line 5" >> file2 &&
git add file2 &&
git reset --merge second &&
! grep 4 file2 &&
! grep 5 file1 &&
grep 4 file1 &&
test "$(git rev-parse HEAD)" = "$(git rev-parse second)" &&
test -z "$(git diff --cached)"
git reset --hard initial &&
echo "line 5" >> file2 &&
git add file2 &&
git reset --merge second &&
! grep 4 file2 &&
! grep 5 file1 &&
grep 4 file1 &&
test "$(git rev-parse HEAD)" = "$(git rev-parse second)" &&
test -z "$(git diff --cached)"
'
# The next test will test the following:
@@ -105,10 +105,10 @@ test_expect_success 'reset --merge is ok again when switching back (1)' '
# ----------------------------------------------------
# file1: B B C D --keep (disallowed)
test_expect_success 'reset --keep fails with changes in index in files it touches' '
git reset --hard second &&
echo "line 5" >> file1 &&
git add file1 &&
test_must_fail git reset --keep HEAD^
git reset --hard second &&
echo "line 5" >> file1 &&
git add file1 &&
test_must_fail git reset --keep HEAD^
'
# The next test will test the following:
@@ -118,23 +118,23 @@ test_expect_success 'reset --keep fails with changes in index in files it touche
# file1: C C C D --merge D D D
# file2: C C D D --merge D D D
test_expect_success 'reset --merge discards changes added to index (2)' '
git reset --hard second &&
echo "line 4" >> file2 &&
git add file2 &&
git reset --merge HEAD^ &&
! grep 4 file2 &&
test "$(git rev-parse HEAD)" = "$(git rev-parse initial)" &&
test -z "$(git diff)" &&
test -z "$(git diff --cached)"
git reset --hard second &&
echo "line 4" >> file2 &&
git add file2 &&
git reset --merge HEAD^ &&
! grep 4 file2 &&
test "$(git rev-parse HEAD)" = "$(git rev-parse initial)" &&
test -z "$(git diff)" &&
test -z "$(git diff --cached)"
'
test_expect_success 'reset --merge is ok again when switching back (2)' '
git reset --hard initial &&
git reset --merge second &&
! grep 4 file2 &&
grep 4 file1 &&
test "$(git rev-parse HEAD)" = "$(git rev-parse second)" &&
test -z "$(git diff --cached)"
git reset --hard initial &&
git reset --merge second &&
! grep 4 file2 &&
grep 4 file1 &&
test "$(git rev-parse HEAD)" = "$(git rev-parse second)" &&
test -z "$(git diff --cached)"
'
# The next test will test the following:
@@ -144,21 +144,21 @@ test_expect_success 'reset --merge is ok again when switching back (2)' '
# file1: C C C D --keep D D D
# file2: C C D D --keep C D D
test_expect_success 'reset --keep keeps changes it does not touch' '
git reset --hard second &&
echo "line 4" >> file2 &&
git add file2 &&
git reset --keep HEAD^ &&
grep 4 file2 &&
test "$(git rev-parse HEAD)" = "$(git rev-parse initial)" &&
test -z "$(git diff --cached)"
git reset --hard second &&
echo "line 4" >> file2 &&
git add file2 &&
git reset --keep HEAD^ &&
grep 4 file2 &&
test "$(git rev-parse HEAD)" = "$(git rev-parse initial)" &&
test -z "$(git diff --cached)"
'
test_expect_success 'reset --keep keeps changes when switching back' '
git reset --keep second &&
grep 4 file2 &&
grep 4 file1 &&
test "$(git rev-parse HEAD)" = "$(git rev-parse second)" &&
test -z "$(git diff --cached)"
git reset --keep second &&
grep 4 file2 &&
grep 4 file1 &&
test "$(git rev-parse HEAD)" = "$(git rev-parse second)" &&
test -z "$(git diff --cached)"
'
# The next test will test the following:
@@ -167,14 +167,14 @@ test_expect_success 'reset --keep keeps changes when switching back' '
# ----------------------------------------------------
# file1: A B B C --merge (disallowed)
test_expect_success 'reset --merge fails with changes in file it touches' '
git reset --hard second &&
echo "line 5" >> file1 &&
test_tick &&
git commit -m "add line 5" file1 &&
sed -e "s/line 1/changed line 1/" <file1 >file3 &&
mv file3 file1 &&
test_must_fail git reset --merge HEAD^ 2>err.log &&
grep file1 err.log | grep "not uptodate"
git reset --hard second &&
echo "line 5" >> file1 &&
test_tick &&
git commit -m "add line 5" file1 &&
sed -e "s/line 1/changed line 1/" <file1 >file3 &&
mv file3 file1 &&
test_must_fail git reset --merge HEAD^ 2>err.log &&
grep file1 err.log | grep "not uptodate"
'
# The next test will test the following:
@@ -183,36 +183,36 @@ test_expect_success 'reset --merge fails with changes in file it touches' '
# ----------------------------------------------------
# file1: A B B C --keep (disallowed)
test_expect_success 'reset --keep fails with changes in file it touches' '
git reset --hard second &&
echo "line 5" >> file1 &&
test_tick &&
git commit -m "add line 5" file1 &&
sed -e "s/line 1/changed line 1/" <file1 >file3 &&
mv file3 file1 &&
test_must_fail git reset --keep HEAD^ 2>err.log &&
grep file1 err.log | grep "not uptodate"
git reset --hard second &&
echo "line 5" >> file1 &&
test_tick &&
git commit -m "add line 5" file1 &&
sed -e "s/line 1/changed line 1/" <file1 >file3 &&
mv file3 file1 &&
test_must_fail git reset --keep HEAD^ 2>err.log &&
grep file1 err.log | grep "not uptodate"
'
test_expect_success 'setup 3 different branches' '
git reset --hard second &&
git branch branch1 &&
git branch branch2 &&
git branch branch3 &&
git checkout branch1 &&
echo "line 5 in branch1" >> file1 &&
test_tick &&
git commit -a -m "change in branch1" &&
git checkout branch2 &&
echo "line 5 in branch2" >> file1 &&
test_tick &&
git commit -a -m "change in branch2" &&
git tag third &&
git checkout branch3 &&
echo a new file >file3 &&
rm -f file1 &&
git add file3 &&
test_tick &&
git commit -a -m "change in branch3"
git reset --hard second &&
git branch branch1 &&
git branch branch2 &&
git branch branch3 &&
git checkout branch1 &&
echo "line 5 in branch1" >> file1 &&
test_tick &&
git commit -a -m "change in branch1" &&
git checkout branch2 &&
echo "line 5 in branch2" >> file1 &&
test_tick &&
git commit -a -m "change in branch2" &&
git tag third &&
git checkout branch3 &&
echo a new file >file3 &&
rm -f file1 &&
git add file3 &&
test_tick &&
git commit -a -m "change in branch3"
'
# The next test will test the following:
@@ -221,12 +221,12 @@ test_expect_success 'setup 3 different branches' '
# ----------------------------------------------------
# file1: X U B C --merge C C C
test_expect_success '"reset --merge HEAD^" is ok with pending merge' '
git checkout third &&
test_must_fail git merge branch1 &&
git reset --merge HEAD^ &&
test "$(git rev-parse HEAD)" = "$(git rev-parse second)" &&
test -z "$(git diff --cached)" &&
test -z "$(git diff)"
git checkout third &&
test_must_fail git merge branch1 &&
git reset --merge HEAD^ &&
test "$(git rev-parse HEAD)" = "$(git rev-parse second)" &&
test -z "$(git diff --cached)" &&
test -z "$(git diff)"
'
# The next test will test the following:
@@ -235,10 +235,10 @@ test_expect_success '"reset --merge HEAD^" is ok with pending merge' '
# ----------------------------------------------------
# file1: X U B C --keep (disallowed)
test_expect_success '"reset --keep HEAD^" fails with pending merge' '
git reset --hard third &&
test_must_fail git merge branch1 &&
test_must_fail git reset --keep HEAD^ 2>err.log &&
test_i18ngrep "middle of a merge" err.log
git reset --hard third &&
test_must_fail git merge branch1 &&
test_must_fail git reset --keep HEAD^ 2>err.log &&
test_i18ngrep "middle of a merge" err.log
'
# The next test will test the following:
@@ -247,12 +247,12 @@ test_expect_success '"reset --keep HEAD^" fails with pending merge' '
# ----------------------------------------------------
# file1: X U B B --merge B B B
test_expect_success '"reset --merge HEAD" is ok with pending merge' '
git reset --hard third &&
test_must_fail git merge branch1 &&
git reset --merge HEAD &&
test "$(git rev-parse HEAD)" = "$(git rev-parse third)" &&
test -z "$(git diff --cached)" &&
test -z "$(git diff)"
git reset --hard third &&
test_must_fail git merge branch1 &&
git reset --merge HEAD &&
test "$(git rev-parse HEAD)" = "$(git rev-parse third)" &&
test -z "$(git diff --cached)" &&
test -z "$(git diff)"
'
# The next test will test the following:
@@ -261,36 +261,36 @@ test_expect_success '"reset --merge HEAD" is ok with pending merge' '
# ----------------------------------------------------
# file1: X U B B --keep (disallowed)
test_expect_success '"reset --keep HEAD" fails with pending merge' '
git reset --hard third &&
test_must_fail git merge branch1 &&
test_must_fail git reset --keep HEAD 2>err.log &&
test_i18ngrep "middle of a merge" err.log
git reset --hard third &&
test_must_fail git merge branch1 &&
test_must_fail git reset --keep HEAD 2>err.log &&
test_i18ngrep "middle of a merge" err.log
'
test_expect_success '--merge is ok with added/deleted merge' '
git reset --hard third &&
rm -f file2 &&
test_must_fail git merge branch3 &&
! test -f file2 &&
test -f file3 &&
git diff --exit-code file3 &&
git diff --exit-code branch3 file3 &&
git reset --merge HEAD &&
! test -f file3 &&
! test -f file2 &&
git diff --exit-code --cached
git reset --hard third &&
rm -f file2 &&
test_must_fail git merge branch3 &&
! test -f file2 &&
test -f file3 &&
git diff --exit-code file3 &&
git diff --exit-code branch3 file3 &&
git reset --merge HEAD &&
! test -f file3 &&
! test -f file2 &&
git diff --exit-code --cached
'
test_expect_success '--keep fails with added/deleted merge' '
git reset --hard third &&
rm -f file2 &&
test_must_fail git merge branch3 &&
! test -f file2 &&
test -f file3 &&
git diff --exit-code file3 &&
git diff --exit-code branch3 file3 &&
test_must_fail git reset --keep HEAD 2>err.log &&
test_i18ngrep "middle of a merge" err.log
git reset --hard third &&
rm -f file2 &&
test_must_fail git merge branch3 &&
! test -f file2 &&
test -f file3 &&
git diff --exit-code file3 &&
git diff --exit-code branch3 file3 &&
test_must_fail git reset --keep HEAD 2>err.log &&
test_i18ngrep "middle of a merge" err.log
'
test_done

View File

@@ -10,9 +10,9 @@ TEST_PASSES_SANITIZE_LEAK=true
test_expect_success 'creating initial commits' '
test_commit E file1 &&
test_commit D file1 &&
test_commit C file1
test_commit E file1 &&
test_commit D file1 &&
test_commit C file1
'
while read W1 I1 H1 T opt W2 I2 H2
@@ -74,13 +74,13 @@ B C C C keep B C C
EOF
test_expect_success 'setting up branches to test with unmerged entries' '
git reset --hard C &&
git branch branch1 &&
git branch branch2 &&
git checkout branch1 &&
test_commit B1 file1 &&
git checkout branch2 &&
test_commit B file1
git reset --hard C &&
git branch branch1 &&
git branch branch2 &&
git checkout branch1 &&
test_commit B1 file1 &&
git checkout branch2 &&
test_commit B file1
'
while read W1 I1 H1 T opt W2 I2 H2

View File

@@ -372,75 +372,75 @@ test_expect_success 'checkout specific path while in subdirectory' '
'
test_expect_success 'checkout w/--track sets up tracking' '
git config branch.autosetupmerge false &&
git checkout main &&
git checkout --track -b track1 &&
test "$(git config branch.track1.remote)" &&
test "$(git config branch.track1.merge)"
git config branch.autosetupmerge false &&
git checkout main &&
git checkout --track -b track1 &&
test "$(git config branch.track1.remote)" &&
test "$(git config branch.track1.merge)"
'
test_expect_success 'checkout w/autosetupmerge=always sets up tracking' '
test_when_finished git config branch.autosetupmerge false &&
git config branch.autosetupmerge always &&
git checkout main &&
git checkout -b track2 &&
test "$(git config branch.track2.remote)" &&
test "$(git config branch.track2.merge)"
test_when_finished git config branch.autosetupmerge false &&
git config branch.autosetupmerge always &&
git checkout main &&
git checkout -b track2 &&
test "$(git config branch.track2.remote)" &&
test "$(git config branch.track2.merge)"
'
test_expect_success 'checkout w/--track from non-branch HEAD fails' '
git checkout main^0 &&
test_must_fail git symbolic-ref HEAD &&
test_must_fail git checkout --track -b track &&
test_must_fail git rev-parse --verify track &&
test_must_fail git symbolic-ref HEAD &&
test "z$(git rev-parse main^0)" = "z$(git rev-parse HEAD)"
git checkout main^0 &&
test_must_fail git symbolic-ref HEAD &&
test_must_fail git checkout --track -b track &&
test_must_fail git rev-parse --verify track &&
test_must_fail git symbolic-ref HEAD &&
test "z$(git rev-parse main^0)" = "z$(git rev-parse HEAD)"
'
test_expect_success 'checkout w/--track from tag fails' '
git checkout main^0 &&
test_must_fail git symbolic-ref HEAD &&
test_must_fail git checkout --track -b track frotz &&
test_must_fail git rev-parse --verify track &&
test_must_fail git symbolic-ref HEAD &&
test "z$(git rev-parse main^0)" = "z$(git rev-parse HEAD)"
git checkout main^0 &&
test_must_fail git symbolic-ref HEAD &&
test_must_fail git checkout --track -b track frotz &&
test_must_fail git rev-parse --verify track &&
test_must_fail git symbolic-ref HEAD &&
test "z$(git rev-parse main^0)" = "z$(git rev-parse HEAD)"
'
test_expect_success 'detach a symbolic link HEAD' '
git checkout main &&
git config --bool core.prefersymlinkrefs yes &&
git checkout side &&
git checkout main &&
it=$(git symbolic-ref HEAD) &&
test "z$it" = zrefs/heads/main &&
here=$(git rev-parse --verify refs/heads/main) &&
git checkout side^ &&
test "z$(git rev-parse --verify refs/heads/main)" = "z$here"
git checkout main &&
git config --bool core.prefersymlinkrefs yes &&
git checkout side &&
git checkout main &&
it=$(git symbolic-ref HEAD) &&
test "z$it" = zrefs/heads/main &&
here=$(git rev-parse --verify refs/heads/main) &&
git checkout side^ &&
test "z$(git rev-parse --verify refs/heads/main)" = "z$here"
'
test_expect_success 'checkout with --track fakes a sensible -b <name>' '
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" &&
git update-ref refs/remotes/origin/koala/bear renamer &&
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" &&
git update-ref refs/remotes/origin/koala/bear renamer &&
git checkout --track origin/koala/bear &&
test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" &&
test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)" &&
git checkout --track origin/koala/bear &&
test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" &&
test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)" &&
git checkout main && git branch -D koala/bear &&
git checkout main && git branch -D koala/bear &&
git checkout --track refs/remotes/origin/koala/bear &&
test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" &&
test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)" &&
git checkout --track refs/remotes/origin/koala/bear &&
test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" &&
test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)" &&
git checkout main && git branch -D koala/bear &&
git checkout main && git branch -D koala/bear &&
git checkout --track remotes/origin/koala/bear &&
test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" &&
test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)"
git checkout --track remotes/origin/koala/bear &&
test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" &&
test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)"
'
test_expect_success 'checkout with --track, but without -b, fails with too short tracked name' '
test_must_fail git checkout --track renamer
test_must_fail git checkout --track renamer
'
setup_conflicting_index () {

View File

@@ -1519,8 +1519,8 @@ test_expect_success '"status.branch=true" weaker than "--no-branch"' '
'
test_expect_success '"status.branch=true" weaker than "--porcelain"' '
git -c status.branch=true status --porcelain >actual &&
test_cmp expected_nobranch actual
git -c status.branch=true status --porcelain >actual &&
test_cmp expected_nobranch actual
'
test_expect_success '"status.branch=false" same as "--no-branch"' '

View File

@@ -639,41 +639,41 @@ test_expect_success 'merge log message' '
test_debug 'git log --graph --decorate --oneline --all'
test_expect_success 'merge c1 with c0, c2, c0, and c1' '
git reset --hard c1 &&
test_tick &&
git merge c0 c2 c0 c1 &&
verify_merge file result.1-5 &&
verify_parents $c1 $c2
git reset --hard c1 &&
test_tick &&
git merge c0 c2 c0 c1 &&
verify_merge file result.1-5 &&
verify_parents $c1 $c2
'
test_debug 'git log --graph --decorate --oneline --all'
test_expect_success 'merge c1 with c0, c2, c0, and c1' '
git reset --hard c1 &&
test_tick &&
git merge c0 c2 c0 c1 &&
verify_merge file result.1-5 &&
verify_parents $c1 $c2
git reset --hard c1 &&
test_tick &&
git merge c0 c2 c0 c1 &&
verify_merge file result.1-5 &&
verify_parents $c1 $c2
'
test_debug 'git log --graph --decorate --oneline --all'
test_expect_success 'merge c1 with c1 and c2' '
git reset --hard c1 &&
test_tick &&
git merge c1 c2 &&
verify_merge file result.1-5 &&
verify_parents $c1 $c2
git reset --hard c1 &&
test_tick &&
git merge c1 c2 &&
verify_merge file result.1-5 &&
verify_parents $c1 $c2
'
test_debug 'git log --graph --decorate --oneline --all'
test_expect_success 'merge fast-forward in a dirty tree' '
git reset --hard c0 &&
mv file file1 &&
cat file1 >file &&
rm -f file1 &&
git merge c2
git reset --hard c0 &&
mv file file1 &&
cat file1 >file &&
rm -f file1 &&
git merge c2
'
test_debug 'git log --graph --decorate --oneline --all'

View File

@@ -460,10 +460,10 @@ test_expect_success '--write-midx -b packs non-kept objects' '
'
test_expect_success '--write-midx removes stale pack-based bitmaps' '
rm -fr repo &&
git init repo &&
test_when_finished "rm -fr repo" &&
(
rm -fr repo &&
git init repo &&
test_when_finished "rm -fr repo" &&
(
cd repo &&
test_commit base &&
GIT_TEST_MULTI_PACK_INDEX=0 git repack -Ab &&
@@ -477,7 +477,7 @@ test_expect_success '--write-midx removes stale pack-based bitmaps' '
test_path_is_file $midx &&
test_path_is_file $midx-$(midx_checksum $objdir).bitmap &&
test_path_is_missing $pack_bitmap
)
)
'
test_expect_success '--write-midx with --pack-kept-objects' '

View File

@@ -21,7 +21,7 @@ test_expect_success 'git svn help works anywhere' '
'
test_expect_success \
'initialize git svn' '
'initialize git svn' '
mkdir import &&
(
cd import &&
@@ -38,9 +38,9 @@ test_expect_success \
rm -rf import &&
git svn init "$svnrepo"'
test_expect_success \
'import an SVN revision into git' \
'git svn fetch'
test_expect_success 'import an SVN revision into git' '
git svn fetch
'
test_expect_success "checkout from svn" 'svn co "$svnrepo" "$SVN_TREE"'
@@ -233,27 +233,26 @@ test_expect_success POSIXPERM,SYMLINKS "$name" '
'
test_expect_success 'exit if remote refs are ambigious' '
git config --add svn-remote.svn.fetch \
git config --add svn-remote.svn.fetch \
bar:refs/remotes/git-svn &&
test_must_fail git svn migrate
'
test_expect_success 'exit if init-ing a would clobber a URL' '
svnadmin create "${PWD}/svnrepo2" &&
svn mkdir -m "mkdir bar" "${svnrepo}2/bar" &&
git config --unset svn-remote.svn.fetch \
svnadmin create "${PWD}/svnrepo2" &&
svn mkdir -m "mkdir bar" "${svnrepo}2/bar" &&
git config --unset svn-remote.svn.fetch \
"^bar:refs/remotes/git-svn$" &&
test_must_fail git svn init "${svnrepo}2/bar"
'
test_expect_success \
'init allows us to connect to another directory in the same repo' '
git svn init --minimize-url -i bar "$svnrepo/bar" &&
git config --get svn-remote.svn.fetch \
"^bar:refs/remotes/bar$" &&
git config --get svn-remote.svn.fetch \
"^:refs/remotes/git-svn$"
'
test_expect_success 'init allows us to connect to another directory in the same repo' '
git svn init --minimize-url -i bar "$svnrepo/bar" &&
git config --get svn-remote.svn.fetch \
"^bar:refs/remotes/bar$" &&
git config --get svn-remote.svn.fetch \
"^:refs/remotes/git-svn$"
'
test_expect_success 'dcommit $rev does not clobber current branch' '
git svn fetch -i bar &&

View File

@@ -41,51 +41,51 @@ test_expect_success 'init and fetch a moved directory' '
'
test_expect_success 'init and fetch from one svn-remote' '
git config svn-remote.svn.url "$svnrepo" &&
git config --add svn-remote.svn.fetch \
trunk:refs/remotes/svn/trunk &&
git config --add svn-remote.svn.fetch \
thunk:refs/remotes/svn/thunk &&
git svn fetch -i svn/thunk &&
git config svn-remote.svn.url "$svnrepo" &&
git config --add svn-remote.svn.fetch \
trunk:refs/remotes/svn/trunk &&
git config --add svn-remote.svn.fetch \
thunk:refs/remotes/svn/thunk &&
git svn fetch -i svn/thunk &&
test "$(git rev-parse --verify refs/remotes/svn/trunk)" \
= "$(git rev-parse --verify refs/remotes/svn/thunk~1)" &&
= "$(git rev-parse --verify refs/remotes/svn/thunk~1)" &&
git cat-file blob refs/remotes/svn/thunk:readme >actual &&
test "$(sed -n -e "3p" actual)" = goodbye
'
'
test_expect_success 'follow deleted parent' '
(svn_cmd cp -m "resurrecting trunk as junk" \
"$svnrepo"/trunk@2 "$svnrepo"/junk ||
svn cp -m "resurrecting trunk as junk" \
-r2 "$svnrepo"/trunk "$svnrepo"/junk) &&
git config --add svn-remote.svn.fetch \
junk:refs/remotes/svn/junk &&
git svn fetch -i svn/thunk &&
git svn fetch -i svn/junk &&
(svn_cmd cp -m "resurrecting trunk as junk" \
"$svnrepo"/trunk@2 "$svnrepo"/junk ||
svn cp -m "resurrecting trunk as junk" \
-r2 "$svnrepo"/trunk "$svnrepo"/junk) &&
git config --add svn-remote.svn.fetch \
junk:refs/remotes/svn/junk &&
git svn fetch -i svn/thunk &&
git svn fetch -i svn/junk &&
test -z "$(git diff svn/junk svn/trunk)" &&
test "$(git merge-base svn/junk svn/trunk)" \
= "$(git rev-parse svn/trunk)"
'
= "$(git rev-parse svn/trunk)"
'
test_expect_success 'follow larger parent' '
mkdir -p import/trunk/thunk/bump/thud &&
echo hi > import/trunk/thunk/bump/thud/file &&
svn import -m "import a larger parent" import "$svnrepo"/larger-parent &&
svn cp -m "hi" "$svnrepo"/larger-parent "$svnrepo"/another-larger &&
git svn init --minimize-url -i larger \
"$svnrepo"/larger-parent/trunk/thunk/bump/thud &&
git svn fetch -i larger &&
mkdir -p import/trunk/thunk/bump/thud &&
echo hi > import/trunk/thunk/bump/thud/file &&
svn import -m "import a larger parent" import "$svnrepo"/larger-parent &&
svn cp -m "hi" "$svnrepo"/larger-parent "$svnrepo"/another-larger &&
git svn init --minimize-url -i larger \
"$svnrepo"/larger-parent/trunk/thunk/bump/thud &&
git svn fetch -i larger &&
git svn init --minimize-url -i larger-parent \
"$svnrepo"/another-larger/trunk/thunk/bump/thud &&
"$svnrepo"/another-larger/trunk/thunk/bump/thud &&
git svn fetch -i larger-parent &&
git rev-parse --verify refs/remotes/larger &&
git rev-parse --verify \
refs/remotes/larger-parent &&
git rev-parse --verify refs/remotes/larger &&
git rev-parse --verify \
refs/remotes/larger-parent &&
test "$(git merge-base \
refs/remotes/larger-parent \
refs/remotes/larger)" = \
"$(git rev-parse refs/remotes/larger)"
'
"$(git rev-parse refs/remotes/larger)"
'
test_expect_success 'follow higher-level parent' '
svn mkdir -m "follow higher-level parent" "$svnrepo"/blob &&

View File

@@ -50,56 +50,56 @@ check_entries () {
fi
}
test_expect_success \
'New file' \
'mkdir A B C D E F &&
echo hello1 >A/newfile1.txt &&
echo hello2 >B/newfile2.txt &&
cp "$TEST_DIRECTORY"/test-binary-1.png C/newfile3.png &&
cp "$TEST_DIRECTORY"/test-binary-1.png D/newfile4.png &&
git add A/newfile1.txt &&
git add B/newfile2.txt &&
git add C/newfile3.png &&
git add D/newfile4.png &&
git commit -a -m "Test: New file" &&
id=$(git rev-list --max-count=1 HEAD) &&
(cd "$CVSWORK" &&
git cvsexportcommit -c $id &&
check_entries A "newfile1.txt/1.1/" &&
check_entries B "newfile2.txt/1.1/" &&
check_entries C "newfile3.png/1.1/-kb" &&
check_entries D "newfile4.png/1.1/-kb" &&
test_cmp A/newfile1.txt ../A/newfile1.txt &&
test_cmp B/newfile2.txt ../B/newfile2.txt &&
test_cmp C/newfile3.png ../C/newfile3.png &&
test_cmp D/newfile4.png ../D/newfile4.png
)'
test_expect_success 'New file' '
mkdir A B C D E F &&
echo hello1 >A/newfile1.txt &&
echo hello2 >B/newfile2.txt &&
cp "$TEST_DIRECTORY"/test-binary-1.png C/newfile3.png &&
cp "$TEST_DIRECTORY"/test-binary-1.png D/newfile4.png &&
git add A/newfile1.txt &&
git add B/newfile2.txt &&
git add C/newfile3.png &&
git add D/newfile4.png &&
git commit -a -m "Test: New file" &&
id=$(git rev-list --max-count=1 HEAD) &&
(cd "$CVSWORK" &&
git cvsexportcommit -c $id &&
check_entries A "newfile1.txt/1.1/" &&
check_entries B "newfile2.txt/1.1/" &&
check_entries C "newfile3.png/1.1/-kb" &&
check_entries D "newfile4.png/1.1/-kb" &&
test_cmp A/newfile1.txt ../A/newfile1.txt &&
test_cmp B/newfile2.txt ../B/newfile2.txt &&
test_cmp C/newfile3.png ../C/newfile3.png &&
test_cmp D/newfile4.png ../D/newfile4.png
)
'
test_expect_success \
'Remove two files, add two and update two' \
'echo Hello1 >>A/newfile1.txt &&
rm -f B/newfile2.txt &&
rm -f C/newfile3.png &&
echo Hello5 >E/newfile5.txt &&
cp "$TEST_DIRECTORY"/test-binary-2.png D/newfile4.png &&
cp "$TEST_DIRECTORY"/test-binary-1.png F/newfile6.png &&
git add E/newfile5.txt &&
git add F/newfile6.png &&
git commit -a -m "Test: Remove, add and update" &&
id=$(git rev-list --max-count=1 HEAD) &&
(cd "$CVSWORK" &&
git cvsexportcommit -c $id &&
check_entries A "newfile1.txt/1.2/" &&
check_entries B "" &&
check_entries C "" &&
check_entries D "newfile4.png/1.2/-kb" &&
check_entries E "newfile5.txt/1.1/" &&
check_entries F "newfile6.png/1.1/-kb" &&
test_cmp A/newfile1.txt ../A/newfile1.txt &&
test_cmp D/newfile4.png ../D/newfile4.png &&
test_cmp E/newfile5.txt ../E/newfile5.txt &&
test_cmp F/newfile6.png ../F/newfile6.png
)'
test_expect_success 'Remove two files, add two and update two' '
echo Hello1 >>A/newfile1.txt &&
rm -f B/newfile2.txt &&
rm -f C/newfile3.png &&
echo Hello5 >E/newfile5.txt &&
cp "$TEST_DIRECTORY"/test-binary-2.png D/newfile4.png &&
cp "$TEST_DIRECTORY"/test-binary-1.png F/newfile6.png &&
git add E/newfile5.txt &&
git add F/newfile6.png &&
git commit -a -m "Test: Remove, add and update" &&
id=$(git rev-list --max-count=1 HEAD) &&
(cd "$CVSWORK" &&
git cvsexportcommit -c $id &&
check_entries A "newfile1.txt/1.2/" &&
check_entries B "" &&
check_entries C "" &&
check_entries D "newfile4.png/1.2/-kb" &&
check_entries E "newfile5.txt/1.1/" &&
check_entries F "newfile6.png/1.1/-kb" &&
test_cmp A/newfile1.txt ../A/newfile1.txt &&
test_cmp D/newfile4.png ../D/newfile4.png &&
test_cmp E/newfile5.txt ../E/newfile5.txt &&
test_cmp F/newfile6.png ../F/newfile6.png
)
'
# Should fail (but only on the git cvsexportcommit stage)
test_expect_success \
@@ -129,67 +129,67 @@ test_expect_success \
# This test is here because a patch for only binary files will
# fail with gnu patch, so cvsexportcommit must handle that.
test_expect_success \
'Remove only binary files' \
'git reset --hard HEAD^^ &&
rm -f D/newfile4.png &&
git commit -a -m "test: remove only a binary file" &&
id=$(git rev-list --max-count=1 HEAD) &&
(cd "$CVSWORK" &&
git cvsexportcommit -c $id &&
check_entries A "newfile1.txt/1.2/" &&
check_entries B "" &&
check_entries C "" &&
check_entries D "" &&
check_entries E "newfile5.txt/1.1/" &&
check_entries F "newfile6.png/1.1/-kb" &&
test_cmp A/newfile1.txt ../A/newfile1.txt &&
test_cmp E/newfile5.txt ../E/newfile5.txt &&
test_cmp F/newfile6.png ../F/newfile6.png
)'
test_expect_success 'Remove only binary files' '
git reset --hard HEAD^^ &&
rm -f D/newfile4.png &&
git commit -a -m "test: remove only a binary file" &&
id=$(git rev-list --max-count=1 HEAD) &&
(cd "$CVSWORK" &&
git cvsexportcommit -c $id &&
check_entries A "newfile1.txt/1.2/" &&
check_entries B "" &&
check_entries C "" &&
check_entries D "" &&
check_entries E "newfile5.txt/1.1/" &&
check_entries F "newfile6.png/1.1/-kb" &&
test_cmp A/newfile1.txt ../A/newfile1.txt &&
test_cmp E/newfile5.txt ../E/newfile5.txt &&
test_cmp F/newfile6.png ../F/newfile6.png
)
'
test_expect_success \
'Remove only a text file' \
'rm -f A/newfile1.txt &&
git commit -a -m "test: remove only a binary file" &&
id=$(git rev-list --max-count=1 HEAD) &&
(cd "$CVSWORK" &&
git cvsexportcommit -c $id &&
check_entries A "" &&
check_entries B "" &&
check_entries C "" &&
check_entries D "" &&
check_entries E "newfile5.txt/1.1/" &&
check_entries F "newfile6.png/1.1/-kb" &&
test_cmp E/newfile5.txt ../E/newfile5.txt &&
test_cmp F/newfile6.png ../F/newfile6.png
)'
test_expect_success 'Remove only a text file' '
rm -f A/newfile1.txt &&
git commit -a -m "test: remove only a binary file" &&
id=$(git rev-list --max-count=1 HEAD) &&
(cd "$CVSWORK" &&
git cvsexportcommit -c $id &&
check_entries A "" &&
check_entries B "" &&
check_entries C "" &&
check_entries D "" &&
check_entries E "newfile5.txt/1.1/" &&
check_entries F "newfile6.png/1.1/-kb" &&
test_cmp E/newfile5.txt ../E/newfile5.txt &&
test_cmp F/newfile6.png ../F/newfile6.png
)
'
test_expect_success \
'New file with spaces in file name' \
'mkdir "G g" &&
echo ok then >"G g/with spaces.txt" &&
git add "G g/with spaces.txt" && \
cp "$TEST_DIRECTORY"/test-binary-1.png "G g/with spaces.png" && \
git add "G g/with spaces.png" &&
git commit -a -m "With spaces" &&
id=$(git rev-list --max-count=1 HEAD) &&
(cd "$CVSWORK" &&
git cvsexportcommit -c $id &&
check_entries "G g" "with spaces.png/1.1/-kb|with spaces.txt/1.1/"
)'
test_expect_success 'New file with spaces in file name' '
mkdir "G g" &&
echo ok then >"G g/with spaces.txt" &&
git add "G g/with spaces.txt" && \
cp "$TEST_DIRECTORY"/test-binary-1.png "G g/with spaces.png" && \
git add "G g/with spaces.png" &&
git commit -a -m "With spaces" &&
id=$(git rev-list --max-count=1 HEAD) &&
(cd "$CVSWORK" &&
git cvsexportcommit -c $id &&
check_entries "G g" "with spaces.png/1.1/-kb|with spaces.txt/1.1/"
)
'
test_expect_success \
'Update file with spaces in file name' \
'echo Ok then >>"G g/with spaces.txt" &&
cat "$TEST_DIRECTORY"/test-binary-1.png >>"G g/with spaces.png" && \
git add "G g/with spaces.png" &&
git commit -a -m "Update with spaces" &&
id=$(git rev-list --max-count=1 HEAD) &&
(cd "$CVSWORK" &&
git cvsexportcommit -c $id &&
check_entries "G g" "with spaces.png/1.2/-kb|with spaces.txt/1.2/"
)'
test_expect_success 'Update file with spaces in file name' '
echo Ok then >>"G g/with spaces.txt" &&
cat "$TEST_DIRECTORY"/test-binary-1.png >>"G g/with spaces.png" && \
git add "G g/with spaces.png" &&
git commit -a -m "Update with spaces" &&
id=$(git rev-list --max-count=1 HEAD) &&
(cd "$CVSWORK" &&
git cvsexportcommit -c $id &&
check_entries "G g" "with spaces.png/1.2/-kb|with spaces.txt/1.2/"
)
'
# Some filesystems mangle pathnames with UTF-8 characters --
# check and skip
@@ -202,68 +202,68 @@ if p="Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö" &&
then
# This test contains UTF-8 characters
test_expect_success !MINGW \
'File with non-ascii file name' \
'mkdir -p Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö &&
echo Foo >Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&
git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&
cp "$TEST_DIRECTORY"/test-binary-1.png Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
git commit -a -m "Går det så går det" && \
id=$(git rev-list --max-count=1 HEAD) &&
(cd "$CVSWORK" &&
git cvsexportcommit -v -c $id &&
check_entries \
"Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö" \
"gårdetsågårdet.png/1.1/-kb|gårdetsågårdet.txt/1.1/"
)'
test_expect_success !MINGW 'File with non-ascii file name' '
mkdir -p Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö &&
echo Foo >Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&
git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&
cp "$TEST_DIRECTORY"/test-binary-1.png Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
git commit -a -m "Går det går det" && \
id=$(git rev-list --max-count=1 HEAD) &&
(cd "$CVSWORK" &&
git cvsexportcommit -v -c $id &&
check_entries \
"Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö" \
"gårdetsågårdet.png/1.1/-kb|gårdetsågårdet.txt/1.1/"
)
'
fi
rm -fr tst
test_expect_success \
'Mismatching patch should fail' \
'date >>"E/newfile5.txt" &&
git add "E/newfile5.txt" &&
git commit -a -m "Update one" &&
date >>"E/newfile5.txt" &&
git add "E/newfile5.txt" &&
git commit -a -m "Update two" &&
id=$(git rev-list --max-count=1 HEAD) &&
(cd "$CVSWORK" &&
test_must_fail git cvsexportcommit -c $id
)'
test_expect_success 'Mismatching patch should fail' '
date >>"E/newfile5.txt" &&
git add "E/newfile5.txt" &&
git commit -a -m "Update one" &&
date >>"E/newfile5.txt" &&
git add "E/newfile5.txt" &&
git commit -a -m "Update two" &&
id=$(git rev-list --max-count=1 HEAD) &&
(cd "$CVSWORK" &&
test_must_fail git cvsexportcommit -c $id
)
'
test_expect_success FILEMODE \
'Retain execute bit' \
'mkdir G &&
echo executeon >G/on &&
chmod +x G/on &&
echo executeoff >G/off &&
git add G/on &&
git add G/off &&
git commit -a -m "Execute test" &&
(cd "$CVSWORK" &&
git cvsexportcommit -c HEAD &&
test -x G/on &&
! test -x G/off
)'
test_expect_success FILEMODE 'Retain execute bit' '
mkdir G &&
echo executeon >G/on &&
chmod +x G/on &&
echo executeoff >G/off &&
git add G/on &&
git add G/off &&
git commit -a -m "Execute test" &&
(cd "$CVSWORK" &&
git cvsexportcommit -c HEAD &&
test -x G/on &&
! test -x G/off
)
'
test_expect_success '-w option should work with relative GIT_DIR' '
mkdir W &&
echo foobar >W/file1.txt &&
echo bazzle >W/file2.txt &&
git add W/file1.txt &&
git add W/file2.txt &&
git commit -m "More updates" &&
id=$(git rev-list --max-count=1 HEAD) &&
(cd "$GIT_DIR" &&
GIT_DIR=. git cvsexportcommit -w "$CVSWORK" -c $id &&
check_entries "$CVSWORK/W" "file1.txt/1.1/|file2.txt/1.1/" &&
test_cmp "$CVSWORK/W/file1.txt" ../W/file1.txt &&
test_cmp "$CVSWORK/W/file2.txt" ../W/file2.txt
)
mkdir W &&
echo foobar >W/file1.txt &&
echo bazzle >W/file2.txt &&
git add W/file1.txt &&
git add W/file2.txt &&
git commit -m "More updates" &&
id=$(git rev-list --max-count=1 HEAD) &&
(cd "$GIT_DIR" &&
GIT_DIR=. git cvsexportcommit -w "$CVSWORK" -c $id &&
check_entries "$CVSWORK/W" "file1.txt/1.1/|file2.txt/1.1/" &&
test_cmp "$CVSWORK/W/file1.txt" ../W/file1.txt &&
test_cmp "$CVSWORK/W/file2.txt" ../W/file2.txt
)
'
test_expect_success 'check files before directories' '
@@ -290,21 +290,20 @@ test_expect_success 'check files before directories' '
'
test_expect_success 're-commit a removed filename which remains in CVS attic' '
(cd "$CVSWORK" &&
echo >attic_gremlin &&
cvs -Q add attic_gremlin &&
cvs -Q ci -m "added attic_gremlin" &&
rm attic_gremlin &&
cvs -Q rm attic_gremlin &&
cvs -Q ci -m "removed attic_gremlin") &&
(cd "$CVSWORK" &&
echo >attic_gremlin &&
cvs -Q add attic_gremlin &&
cvs -Q ci -m "added attic_gremlin" &&
rm attic_gremlin &&
cvs -Q rm attic_gremlin &&
cvs -Q ci -m "removed attic_gremlin") &&
echo > attic_gremlin &&
git add attic_gremlin &&
git commit -m "Added attic_gremlin" &&
echo > attic_gremlin &&
git add attic_gremlin &&
git commit -m "Added attic_gremlin" &&
git cvsexportcommit -w "$CVSWORK" -c HEAD &&
(cd "$CVSWORK" && cvs -Q update -d) &&
test -f "$CVSWORK/attic_gremlin"
(cd "$CVSWORK" && cvs -Q update -d) &&
test -f "$CVSWORK/attic_gremlin"
'
# the state of the CVS sandbox may be indeterminate for ' space'

View File

@@ -66,10 +66,11 @@ test_expect_success 'setup' '
# note that cvs doesn't accept absolute pathnames
# as argument to co -d
test_expect_success 'basic checkout' \
'GIT_CONFIG="$git_config" cvs -Q co -d cvswork main &&
test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5 | head -n 1))" = "empty/1.1/" &&
test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5 | sed -ne \$p))" = "secondrootfile/1.1/"'
test_expect_success 'basic checkout' '
GIT_CONFIG="$git_config" cvs -Q co -d cvswork main &&
test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5 | head -n 1))" = "empty/1.1/" &&
test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5 | sed -ne \$p))" = "secondrootfile/1.1/"
'
#------------------------
# PSERVER AUTHENTICATION
@@ -115,35 +116,40 @@ Ah<Z:yZZ30 e
END VERIFICATION REQUEST
EOF
test_expect_success 'pserver authentication' \
'cat request-anonymous | git-cvsserver pserver >log 2>&1 &&
sed -ne \$p log | grep "^I LOVE YOU\$"'
test_expect_success 'pserver authentication' '
cat request-anonymous | git-cvsserver pserver >log 2>&1 &&
sed -ne \$p log | grep "^I LOVE YOU\$"
'
test_expect_success 'pserver authentication failure (non-anonymous user)' \
'if cat request-git | git-cvsserver pserver >log 2>&1
then
false
else
true
fi &&
sed -ne \$p log | grep "^I HATE YOU\$"'
test_expect_success 'pserver authentication failure (non-anonymous user)' '
if cat request-git | git-cvsserver pserver >log 2>&1
then
false
else
true
fi &&
sed -ne \$p log | grep "^I HATE YOU\$"
'
test_expect_success 'pserver authentication success (non-anonymous user with password)' \
'cat login-git-ok | git-cvsserver pserver >log 2>&1 &&
sed -ne \$p log | grep "^I LOVE YOU\$"'
test_expect_success 'pserver authentication success (non-anonymous user with password)' '
cat login-git-ok | git-cvsserver pserver >log 2>&1 &&
sed -ne \$p log | grep "^I LOVE YOU\$"
'
test_expect_success 'pserver authentication (login)' \
'cat login-anonymous | git-cvsserver pserver >log 2>&1 &&
sed -ne \$p log | grep "^I LOVE YOU\$"'
test_expect_success 'pserver authentication (login)' '
cat login-anonymous | git-cvsserver pserver >log 2>&1 &&
sed -ne \$p log | grep "^I LOVE YOU\$"
'
test_expect_success 'pserver authentication failure (login/non-anonymous user)' \
'if cat login-git | git-cvsserver pserver >log 2>&1
then
false
else
true
fi &&
sed -ne \$p log | grep "^I HATE YOU\$"'
test_expect_success 'pserver authentication failure (login/non-anonymous user)' '
if cat login-git | git-cvsserver pserver >log 2>&1
then
false
else
true
fi &&
sed -ne \$p log | grep "^I HATE YOU\$"
'
# misuse pserver authentication for testing of req_Root
@@ -165,36 +171,40 @@ END AUTH REQUEST
Root $WORKDIR
EOF
test_expect_success 'req_Root failure (relative pathname)' \
'if cat request-relative | git-cvsserver pserver >log 2>&1
then
echo unexpected success
false
else
true
fi &&
tail log | grep "^error 1 Root must be an absolute pathname$"'
test_expect_success 'req_Root failure (conflicting roots)' \
'cat request-conflict | git-cvsserver pserver >log 2>&1 &&
tail log | grep "^error 1 Conflicting roots specified$"'
test_expect_success 'req_Root (strict paths)' \
'cat request-anonymous | git-cvsserver --strict-paths pserver "$SERVERDIR" >log 2>&1 &&
sed -ne \$p log | grep "^I LOVE YOU\$"'
test_expect_success 'req_Root failure (strict-paths)' '
! cat request-anonymous |
git-cvsserver --strict-paths pserver "$WORKDIR" >log 2>&1
test_expect_success 'req_Root failure (relative pathname)' '
if cat request-relative | git-cvsserver pserver >log 2>&1
then
echo unexpected success
false
else
true
fi &&
tail log | grep "^error 1 Root must be an absolute pathname$"
'
test_expect_success 'req_Root (w/o strict-paths)' \
'cat request-anonymous | git-cvsserver pserver "$WORKDIR/" >log 2>&1 &&
sed -ne \$p log | grep "^I LOVE YOU\$"'
test_expect_success 'req_Root failure (conflicting roots)' '
cat request-conflict | git-cvsserver pserver >log 2>&1 &&
tail log | grep "^error 1 Conflicting roots specified$"
'
test_expect_success 'req_Root (strict paths)' '
cat request-anonymous | git-cvsserver --strict-paths pserver "$SERVERDIR" >log 2>&1 &&
sed -ne \$p log | grep "^I LOVE YOU\$"
'
test_expect_success 'req_Root failure (strict-paths)' '
! cat request-anonymous |
git-cvsserver --strict-paths pserver "$WORKDIR" >log 2>&1
'
test_expect_success 'req_Root (w/o strict-paths)' '
cat request-anonymous | git-cvsserver pserver "$WORKDIR/" >log 2>&1 &&
sed -ne \$p log | grep "^I LOVE YOU\$"
'
test_expect_success 'req_Root failure (w/o strict-paths)' '
! cat request-anonymous |
git-cvsserver pserver "$WORKDIR/gitcvs" >log 2>&1
! cat request-anonymous |
git-cvsserver pserver "$WORKDIR/gitcvs" >log 2>&1
'
cat >request-base <<EOF
@@ -206,27 +216,30 @@ END AUTH REQUEST
Root /gitcvs.git
EOF
test_expect_success 'req_Root (base-path)' \
'cat request-base | git-cvsserver --strict-paths --base-path "$WORKDIR/" pserver "$SERVERDIR" >log 2>&1 &&
sed -ne \$p log | grep "^I LOVE YOU\$"'
test_expect_success 'req_Root (base-path)' '
cat request-base | git-cvsserver --strict-paths --base-path "$WORKDIR/" pserver "$SERVERDIR" >log 2>&1 &&
sed -ne \$p log | grep "^I LOVE YOU\$"
'
test_expect_success 'req_Root failure (base-path)' '
! cat request-anonymous |
git-cvsserver --strict-paths --base-path "$WORKDIR" pserver "$SERVERDIR" >log 2>&1
! cat request-anonymous |
git-cvsserver --strict-paths --base-path "$WORKDIR" pserver "$SERVERDIR" >log 2>&1
'
GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false || exit 1
test_expect_success 'req_Root (export-all)' \
'cat request-anonymous | git-cvsserver --export-all pserver "$WORKDIR" >log 2>&1 &&
sed -ne \$p log | grep "^I LOVE YOU\$"'
test_expect_success 'req_Root (export-all)' '
cat request-anonymous | git-cvsserver --export-all pserver "$WORKDIR" >log 2>&1 &&
sed -ne \$p log | grep "^I LOVE YOU\$"
'
test_expect_success 'req_Root failure (export-all w/o directory list)' \
'! (cat request-anonymous | git-cvsserver --export-all pserver >log 2>&1 || false)'
test_expect_success 'req_Root failure (export-all w/o directory list)' '
! (cat request-anonymous | git-cvsserver --export-all pserver >log 2>&1 || false)'
test_expect_success 'req_Root (everything together)' \
'cat request-base | git-cvsserver --export-all --strict-paths --base-path "$WORKDIR/" pserver "$SERVERDIR" >log 2>&1 &&
sed -ne \$p log | grep "^I LOVE YOU\$"'
test_expect_success 'req_Root (everything together)' '
cat request-base | git-cvsserver --export-all --strict-paths --base-path "$WORKDIR/" pserver "$SERVERDIR" >log 2>&1 &&
sed -ne \$p log | grep "^I LOVE YOU\$"
'
GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true || exit 1
@@ -247,45 +260,49 @@ test_expect_success 'gitcvs.enabled = false' \
test ! -d cvswork2'
rm -fr cvswork2
test_expect_success 'gitcvs.ext.enabled = true' \
'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true &&
GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false &&
GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 main >cvs.log 2>&1 &&
test_cmp cvswork cvswork2'
test_expect_success 'gitcvs.ext.enabled = true' '
GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true &&
GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false &&
GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 main >cvs.log 2>&1 &&
test_cmp cvswork cvswork2
'
rm -fr cvswork2
test_expect_success 'gitcvs.ext.enabled = false' \
'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled false &&
GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true &&
if GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 main >cvs.log 2>&1
then
echo unexpected cvs success
false
else
true
fi &&
grep "GITCVS emulation disabled" cvs.log &&
test ! -d cvswork2'
test_expect_success 'gitcvs.ext.enabled = false' '
GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled false &&
GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true &&
if GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 main >cvs.log 2>&1
then
echo unexpected cvs success
false
else
true
fi &&
grep "GITCVS emulation disabled" cvs.log &&
test ! -d cvswork2
'
rm -fr cvswork2
test_expect_success 'gitcvs.dbname' \
'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true &&
GIT_DIR="$SERVERDIR" git config gitcvs.dbname %Ggitcvs.%a.%m.sqlite &&
GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 main >cvs.log 2>&1 &&
test_cmp cvswork cvswork2 &&
test -f "$SERVERDIR/gitcvs.ext.main.sqlite" &&
cmp "$SERVERDIR/gitcvs.main.sqlite" "$SERVERDIR/gitcvs.ext.main.sqlite"'
test_expect_success 'gitcvs.dbname' '
GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true &&
GIT_DIR="$SERVERDIR" git config gitcvs.dbname %Ggitcvs.%a.%m.sqlite &&
GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 main >cvs.log 2>&1 &&
test_cmp cvswork cvswork2 &&
test -f "$SERVERDIR/gitcvs.ext.main.sqlite" &&
cmp "$SERVERDIR/gitcvs.main.sqlite" "$SERVERDIR/gitcvs.ext.main.sqlite"
'
rm -fr cvswork2
test_expect_success 'gitcvs.ext.dbname' \
'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true &&
GIT_DIR="$SERVERDIR" git config gitcvs.ext.dbname %Ggitcvs1.%a.%m.sqlite &&
GIT_DIR="$SERVERDIR" git config gitcvs.dbname %Ggitcvs2.%a.%m.sqlite &&
GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 main >cvs.log 2>&1 &&
test_cmp cvswork cvswork2 &&
test -f "$SERVERDIR/gitcvs1.ext.main.sqlite" &&
test ! -f "$SERVERDIR/gitcvs2.ext.main.sqlite" &&
cmp "$SERVERDIR/gitcvs.main.sqlite" "$SERVERDIR/gitcvs1.ext.main.sqlite"'
test_expect_success 'gitcvs.ext.dbname' '
GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true &&
GIT_DIR="$SERVERDIR" git config gitcvs.ext.dbname %Ggitcvs1.%a.%m.sqlite &&
GIT_DIR="$SERVERDIR" git config gitcvs.dbname %Ggitcvs2.%a.%m.sqlite &&
GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 main >cvs.log 2>&1 &&
test_cmp cvswork cvswork2 &&
test -f "$SERVERDIR/gitcvs1.ext.main.sqlite" &&
test ! -f "$SERVERDIR/gitcvs2.ext.main.sqlite" &&
cmp "$SERVERDIR/gitcvs.main.sqlite" "$SERVERDIR/gitcvs1.ext.main.sqlite"
'
#------------
@@ -299,109 +316,115 @@ GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true &&
GIT_DIR="$SERVERDIR" git config gitcvs.logfile "$SERVERDIR/gitcvs.log" ||
exit 1
test_expect_success 'cvs update (create new file)' \
'echo testfile1 >testfile1 &&
git add testfile1 &&
git commit -q -m "Add testfile1" &&
git push gitcvs.git >/dev/null &&
cd cvswork &&
GIT_CONFIG="$git_config" cvs -Q update &&
test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.1/" &&
test_cmp testfile1 ../testfile1'
test_expect_success 'cvs update (create new file)' '
echo testfile1 >testfile1 &&
git add testfile1 &&
git commit -q -m "Add testfile1" &&
git push gitcvs.git >/dev/null &&
cd cvswork &&
GIT_CONFIG="$git_config" cvs -Q update &&
test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.1/" &&
test_cmp testfile1 ../testfile1
'
cd "$WORKDIR"
test_expect_success 'cvs update (update existing file)' \
'echo line 2 >>testfile1 &&
git add testfile1 &&
git commit -q -m "Append to testfile1" &&
git push gitcvs.git >/dev/null &&
cd cvswork &&
GIT_CONFIG="$git_config" cvs -Q update &&
test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.2/" &&
test_cmp testfile1 ../testfile1'
test_expect_success 'cvs update (update existing file)' '
echo line 2 >>testfile1 &&
git add testfile1 &&
git commit -q -m "Append to testfile1" &&
git push gitcvs.git >/dev/null &&
cd cvswork &&
GIT_CONFIG="$git_config" cvs -Q update &&
test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.2/" &&
test_cmp testfile1 ../testfile1
'
cd "$WORKDIR"
#TODO: cvsserver doesn't support update w/o -d
test_expect_failure "cvs update w/o -d doesn't create subdir (TODO)" '
mkdir test &&
echo >test/empty &&
git add test &&
git commit -q -m "Single Subdirectory" &&
git push gitcvs.git >/dev/null &&
cd cvswork &&
GIT_CONFIG="$git_config" cvs -Q update &&
test ! -d test
mkdir test &&
echo >test/empty &&
git add test &&
git commit -q -m "Single Subdirectory" &&
git push gitcvs.git >/dev/null &&
cd cvswork &&
GIT_CONFIG="$git_config" cvs -Q update &&
test ! -d test
'
cd "$WORKDIR"
test_expect_success 'cvs update (subdirectories)' \
'(for dir in A A/B A/B/C A/D E; do
mkdir $dir &&
echo "test file in $dir" >"$dir/file_in_$(echo $dir|sed -e "s#/# #g")" &&
git add $dir || exit 1
done) &&
git commit -q -m "deep sub directory structure" &&
git push gitcvs.git >/dev/null &&
cd cvswork &&
GIT_CONFIG="$git_config" cvs -Q update -d &&
(for dir in A A/B A/B/C A/D E; do
filename="file_in_$(echo $dir|sed -e "s#/# #g")" &&
if test "$(echo $(grep -v ^D $dir/CVS/Entries|cut -d/ -f2,3,5))" = "$filename/1.1/" &&
test_cmp "$dir/$filename" "../$dir/$filename"; then
:
else
exit 1
fi
done)'
test_expect_success 'cvs update (subdirectories)' '
(for dir in A A/B A/B/C A/D E; do
mkdir $dir &&
echo "test file in $dir" >"$dir/file_in_$(echo $dir|sed -e "s#/# #g")" &&
git add $dir || exit 1
done) &&
git commit -q -m "deep sub directory structure" &&
git push gitcvs.git >/dev/null &&
cd cvswork &&
GIT_CONFIG="$git_config" cvs -Q update -d &&
(for dir in A A/B A/B/C A/D E; do
filename="file_in_$(echo $dir|sed -e "s#/# #g")" &&
if test "$(echo $(grep -v ^D $dir/CVS/Entries|cut -d/ -f2,3,5))" = "$filename/1.1/" &&
test_cmp "$dir/$filename" "../$dir/$filename"; then
:
else
exit 1
fi
done)
'
cd "$WORKDIR"
test_expect_success 'cvs update (delete file)' \
'git rm testfile1 &&
git commit -q -m "Remove testfile1" &&
git push gitcvs.git >/dev/null &&
cd cvswork &&
GIT_CONFIG="$git_config" cvs -Q update &&
test -z "$(grep testfile1 CVS/Entries)" &&
test ! -f testfile1'
test_expect_success 'cvs update (delete file)' '
git rm testfile1 &&
git commit -q -m "Remove testfile1" &&
git push gitcvs.git >/dev/null &&
cd cvswork &&
GIT_CONFIG="$git_config" cvs -Q update &&
test -z "$(grep testfile1 CVS/Entries)" &&
test ! -f testfile1
'
cd "$WORKDIR"
test_expect_success 'cvs update (re-add deleted file)' \
'echo readded testfile >testfile1 &&
git add testfile1 &&
git commit -q -m "Re-Add testfile1" &&
git push gitcvs.git >/dev/null &&
cd cvswork &&
GIT_CONFIG="$git_config" cvs -Q update &&
test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.4/" &&
test_cmp testfile1 ../testfile1'
test_expect_success 'cvs update (re-add deleted file)' '
echo readded testfile >testfile1 &&
git add testfile1 &&
git commit -q -m "Re-Add testfile1" &&
git push gitcvs.git >/dev/null &&
cd cvswork &&
GIT_CONFIG="$git_config" cvs -Q update &&
test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.4/" &&
test_cmp testfile1 ../testfile1
'
cd "$WORKDIR"
test_expect_success 'cvs update (merge)' \
'echo Line 0 >expected &&
for i in 1 2 3 4 5 6 7
do
echo Line $i >>merge &&
echo Line $i >>expected || return 1
done &&
echo Line 8 >>expected &&
git add merge &&
git commit -q -m "Merge test (pre-merge)" &&
git push gitcvs.git >/dev/null &&
cd cvswork &&
GIT_CONFIG="$git_config" cvs -Q update &&
test "$(echo $(grep merge CVS/Entries|cut -d/ -f2,3,5))" = "merge/1.1/" &&
test_cmp merge ../merge &&
( echo Line 0 && cat merge ) >merge.tmp &&
mv merge.tmp merge &&
cd "$WORKDIR" &&
echo Line 8 >>merge &&
git add merge &&
git commit -q -m "Merge test (merge)" &&
git push gitcvs.git >/dev/null &&
cd cvswork &&
sleep 1 && touch merge &&
GIT_CONFIG="$git_config" cvs -Q update &&
test_cmp merge ../expected'
test_expect_success 'cvs update (merge)' '
echo Line 0 >expected &&
for i in 1 2 3 4 5 6 7
do
echo Line $i >>merge &&
echo Line $i >>expected || return 1
done &&
echo Line 8 >>expected &&
git add merge &&
git commit -q -m "Merge test (pre-merge)" &&
git push gitcvs.git >/dev/null &&
cd cvswork &&
GIT_CONFIG="$git_config" cvs -Q update &&
test "$(echo $(grep merge CVS/Entries|cut -d/ -f2,3,5))" = "merge/1.1/" &&
test_cmp merge ../merge &&
( echo Line 0 && cat merge ) >merge.tmp &&
mv merge.tmp merge &&
cd "$WORKDIR" &&
echo Line 8 >>merge &&
git add merge &&
git commit -q -m "Merge test (merge)" &&
git push gitcvs.git >/dev/null &&
cd cvswork &&
sleep 1 && touch merge &&
GIT_CONFIG="$git_config" cvs -Q update &&
test_cmp merge ../expected
'
cd "$WORKDIR"
@@ -418,55 +441,58 @@ do
echo Line $i >>expected.C
done
test_expect_success 'cvs update (conflict merge)' \
'( echo LINE 0 && cat merge ) >merge.tmp &&
mv merge.tmp merge &&
git add merge &&
git commit -q -m "Merge test (conflict)" &&
git push gitcvs.git >/dev/null &&
cd cvswork &&
GIT_CONFIG="$git_config" cvs -Q update &&
test_cmp merge ../expected.C'
test_expect_success 'cvs update (conflict merge)' '
( echo LINE 0 && cat merge ) >merge.tmp &&
mv merge.tmp merge &&
git add merge &&
git commit -q -m "Merge test (conflict)" &&
git push gitcvs.git >/dev/null &&
cd cvswork &&
GIT_CONFIG="$git_config" cvs -Q update &&
test_cmp merge ../expected.C
'
cd "$WORKDIR"
test_expect_success 'cvs update (-C)' \
'cd cvswork &&
GIT_CONFIG="$git_config" cvs -Q update -C &&
test_cmp merge ../merge'
test_expect_success 'cvs update (-C)' '
cd cvswork &&
GIT_CONFIG="$git_config" cvs -Q update -C &&
test_cmp merge ../merge
'
cd "$WORKDIR"
test_expect_success 'cvs update (merge no-op)' \
'echo Line 9 >>merge &&
cp merge cvswork/merge &&
git add merge &&
git commit -q -m "Merge test (no-op)" &&
git push gitcvs.git >/dev/null &&
cd cvswork &&
sleep 1 && touch merge &&
GIT_CONFIG="$git_config" cvs -Q update &&
test_cmp merge ../merge'
test_expect_success 'cvs update (merge no-op)' '
echo Line 9 >>merge &&
cp merge cvswork/merge &&
git add merge &&
git commit -q -m "Merge test (no-op)" &&
git push gitcvs.git >/dev/null &&
cd cvswork &&
sleep 1 && touch merge &&
GIT_CONFIG="$git_config" cvs -Q update &&
test_cmp merge ../merge
'
cd "$WORKDIR"
test_expect_success 'cvs update (-p)' '
touch really-empty &&
echo Line 1 > no-lf &&
printf "Line 2" >> no-lf &&
git add really-empty no-lf &&
git commit -q -m "Update -p test" &&
git push gitcvs.git >/dev/null &&
cd cvswork &&
GIT_CONFIG="$git_config" cvs update &&
for i in merge no-lf empty really-empty; do
GIT_CONFIG="$git_config" cvs update -p "$i" >$i.out &&
test_cmp $i.out ../$i || return 1
done
touch really-empty &&
echo Line 1 > no-lf &&
printf "Line 2" >> no-lf &&
git add really-empty no-lf &&
git commit -q -m "Update -p test" &&
git push gitcvs.git >/dev/null &&
cd cvswork &&
GIT_CONFIG="$git_config" cvs update &&
for i in merge no-lf empty really-empty; do
GIT_CONFIG="$git_config" cvs update -p "$i" >$i.out &&
test_cmp $i.out ../$i || return 1
done
'
cd "$WORKDIR"
test_expect_success 'cvs update (module list supports packed refs)' '
GIT_DIR="$SERVERDIR" git pack-refs --all &&
GIT_CONFIG="$git_config" cvs -n up -d 2> out &&
grep "cvs update: New directory \`main'\''" < out
GIT_DIR="$SERVERDIR" git pack-refs --all &&
GIT_CONFIG="$git_config" cvs -n up -d 2> out &&
grep "cvs update: New directory \`main'\''" < out
'
#------------
@@ -475,30 +501,30 @@ test_expect_success 'cvs update (module list supports packed refs)' '
cd "$WORKDIR"
test_expect_success 'cvs status' '
mkdir status.dir &&
echo Line > status.dir/status.file &&
echo Line > status.file &&
git add status.dir status.file &&
git commit -q -m "Status test" &&
git push gitcvs.git >/dev/null &&
cd cvswork &&
GIT_CONFIG="$git_config" cvs update &&
GIT_CONFIG="$git_config" cvs status | grep "^File: status.file" >../out &&
test_line_count = 2 ../out
mkdir status.dir &&
echo Line > status.dir/status.file &&
echo Line > status.file &&
git add status.dir status.file &&
git commit -q -m "Status test" &&
git push gitcvs.git >/dev/null &&
cd cvswork &&
GIT_CONFIG="$git_config" cvs update &&
GIT_CONFIG="$git_config" cvs status | grep "^File: status.file" >../out &&
test_line_count = 2 ../out
'
cd "$WORKDIR"
test_expect_success 'cvs status (nonrecursive)' '
cd cvswork &&
GIT_CONFIG="$git_config" cvs status -l | grep "^File: status.file" >../out &&
test_line_count = 1 ../out
cd cvswork &&
GIT_CONFIG="$git_config" cvs status -l | grep "^File: status.file" >../out &&
test_line_count = 1 ../out
'
cd "$WORKDIR"
test_expect_success 'cvs status (no subdirs in header)' '
cd cvswork &&
GIT_CONFIG="$git_config" cvs status | grep ^File: >../out &&
! grep / <../out
cd cvswork &&
GIT_CONFIG="$git_config" cvs status | grep ^File: >../out &&
! grep / <../out
'
#------------
@@ -507,9 +533,9 @@ test_expect_success 'cvs status (no subdirs in header)' '
cd "$WORKDIR"
test_expect_success 'cvs co -c (shows module database)' '
GIT_CONFIG="$git_config" cvs co -c > out &&
grep "^main[ ][ ]*main$" <out &&
! grep -v "^main[ ][ ]*main$" <out
GIT_CONFIG="$git_config" cvs co -c > out &&
grep "^main[ ][ ]*main$" <out &&
! grep -v "^main[ ][ ]*main$" <out
'
#------------
@@ -575,11 +601,11 @@ expectStat="$?"
cd "$WORKDIR"
test_expect_success 'cvs log' '
cd cvswork &&
test x"$expectStat" = x"0" &&
GIT_CONFIG="$git_config" cvs log merge >../out &&
sed -e "s%2[0-9][0-9][0-9]/[01][0-9]/[0-3][0-9] [0-2][0-9]:[0-5][0-9]:[0-5][0-9]%__DATE__%" ../out > ../actual &&
test_cmp ../expect ../actual
cd cvswork &&
test x"$expectStat" = x"0" &&
GIT_CONFIG="$git_config" cvs log merge >../out &&
sed -e "s%2[0-9][0-9][0-9]/[01][0-9]/[0-3][0-9] [0-2][0-9]:[0-5][0-9]:[0-5][0-9]%__DATE__%" ../out > ../actual &&
test_cmp ../expect ../actual
'
#------------
@@ -588,11 +614,11 @@ test_expect_success 'cvs log' '
cd "$WORKDIR"
test_expect_success 'cvs annotate' '
cd cvswork &&
GIT_CONFIG="$git_config" cvs annotate merge >../out &&
sed -e "s/ .*//" ../out >../actual &&
printf "1.%d\n" 3 1 1 1 1 1 1 1 2 4 >../expect &&
test_cmp ../expect ../actual
cd cvswork &&
GIT_CONFIG="$git_config" cvs annotate merge >../out &&
sed -e "s/ .*//" ../out >../actual &&
printf "1.%d\n" 3 1 1 1 1 1 1 1 2 4 >../expect &&
test_cmp ../expect ../actual
'
#------------