]> git.ipfire.org Git - thirdparty/git.git/blame - t/lib-cvs.sh
path.c: don't call the match function without value in trie_find()
[thirdparty/git.git] / t / lib-cvs.sh
CommitLineData
c74c7203 1# Shell library sourced instead of ./test-lib.sh by cvsimport tests.
535bb893
MH
2
3. ./test-lib.sh
4
5unset CVS_SERVER
535bb893
MH
6
7if ! type cvs >/dev/null 2>&1
8then
e8344e86 9 skip_all='skipping cvsimport tests, cvs not found'
535bb893 10 test_done
535bb893
MH
11fi
12
161261b1
MH
13CVS="cvs -f"
14export CVS
15
03db9178 16cvsps_version=$(cvsps -h 2>&1 | sed -ne 's/cvsps version //p')
535bb893
MH
17case "$cvsps_version" in
182.1 | 2.2*)
19 ;;
20'')
e8344e86 21 skip_all='skipping cvsimport tests, cvsps not found'
535bb893 22 test_done
535bb893
MH
23 ;;
24*)
e8344e86 25 skip_all='skipping cvsimport tests, unsupported cvsps version'
535bb893 26 test_done
535bb893
MH
27 ;;
28esac
cefa318d 29
9b777a16
JH
30setup_cvs_test_repository () {
31 CVSROOT="$(pwd)/.cvsroot" &&
32 cp -r "$TEST_DIRECTORY/$1/cvsroot" "$CVSROOT" &&
33 export CVSROOT
34}
35
cefa318d
MH
36test_cvs_co () {
37 # Usage: test_cvs_co BRANCH_NAME
38 rm -rf module-cvs-"$1"
39 if [ "$1" = "master" ]
40 then
41 $CVS co -P -d module-cvs-"$1" -A module
42 else
43 $CVS co -P -d module-cvs-"$1" -r "$1" module
44 fi
45}
46
47test_git_co () {
48 # Usage: test_git_co BRANCH_NAME
49 (cd module-git && git checkout "$1")
50}
51
52test_cmp_branch_file () {
53 # Usage: test_cmp_branch_file BRANCH_NAME PATH
54 # The branch must already be checked out of CVS and git.
55 test_cmp module-cvs-"$1"/"$2" module-git/"$2"
56}
57
58test_cmp_branch_tree () {
59 # Usage: test_cmp_branch_tree BRANCH_NAME
60 # Check BRANCH_NAME out of CVS and git and make sure that all
61 # of the files and directories are identical.
62
63 test_cvs_co "$1" &&
64 test_git_co "$1" &&
65 (
66 cd module-cvs-"$1"
67 find . -type d -name CVS -prune -o -type f -print
68 ) | sort >module-cvs-"$1".list &&
69 (
70 cd module-git
71 find . -type d -name .git -prune -o -type f -print
72 ) | sort >module-git-"$1".list &&
73 test_cmp module-cvs-"$1".list module-git-"$1".list &&
74 cat module-cvs-"$1".list | while read f
75 do
76 test_cmp_branch_file "$1" "$f" || return 1
77 done
78}