Skip to content

Commit cefa318

Browse files
mhaggergitster
authored andcommitted
Test contents of entire cvsimported "master" tree contents
Test added for completeness (it passes). Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 161261b commit cefa318

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

t/lib-cvs.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,47 @@ case "$cvsps_version" in
3232
exit
3333
;;
3434
esac
35+
36+
test_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+
47+
test_git_co () {
48+
# Usage: test_git_co BRANCH_NAME
49+
(cd module-git && git checkout "$1")
50+
}
51+
52+
test_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+
58+
test_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+
}

t/t9600-cvsimport.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,6 @@ test_expect_success 'import from a CVS working tree' '
121121
122122
'
123123

124+
test_expect_success 'test entire HEAD' 'test_cmp_branch_tree master'
125+
124126
test_done

0 commit comments

Comments
 (0)