1#!/bin/sh
2
3test_description='git-cvsimport basic tests'
4. ./test-lib.sh
5
6if ! ( type cvs && type cvsps ) >/dev/null 2>&1
7then
8 test_expect_success 'skipping cvsimport tests, cvs/cvsps not found' ''
9 test_done
10 exit
11fi
12
13CVSROOT=$(pwd)/cvsroot
14export CVSROOT
15# for clean cvsps cache
16HOME=$(pwd)
17export HOME
18
19test_expect_success 'setup cvsroot' 'cvs init'
20
21test_expect_success 'setup a cvs module' '
22
23 mkdir $CVSROOT/module &&
24 cvs co -d module-cvs module &&
25 cd module-cvs &&
26 cat <<EOF >o_fortuna &&
27O Fortuna
28velut luna
29statu variabilis,
30
31semper crescis
32aut decrescis;
33vita detestabilis
34
35nunc obdurat
36et tunc curat
37ludo mentis aciem,
38
39egestatem,
40potestatem
41dissolvit ut glaciem.
42EOF
43 cvs add o_fortuna &&
44 cat <<EOF >message &&
45add "O Fortuna" lyrics
46
47These public domain lyrics make an excellent sample text.
48EOF
49 cvs commit -F message &&
50 cd ..
51'
52
53test_expect_success 'import a trivial module' '
54
55 git cvsimport -a -z 0 -C module-git module &&
56 git diff module-cvs/o_fortuna module-git/o_fortuna
57
58'
59
60test_expect_success 'pack refs' 'cd module-git && git gc && cd ..'
61
62test_expect_success 'update cvs module' '
63
64 cd module-cvs &&
65 cat <<EOF >o_fortuna &&
66O Fortune,
67like the moon
68you are changeable,
69
70ever waxing
71and waning;
72hateful life
73
74first oppresses
75and then soothes
76as fancy takes it;
77
78poverty
79and power
80it melts them like ice.
81EOF
82 cat <<EOF >message &&
83translate to English
84
85My Latin is terrible.
86EOF
87 cvs commit -F message &&
88 cd ..
89'
90
91test_expect_success 'update git module' '
92
93 cd module-git &&
94 git cvsimport -a -z 0 module &&
95 git merge origin &&
96 cd .. &&
97 git diff module-cvs/o_fortuna module-git/o_fortuna
98
99'
100
101test_expect_success 'update cvs module' '
102
103 cd module-cvs &&
104 echo 1 >tick &&
105 cvs add tick &&
106 cvs commit -m 1
107 cd ..
108
109'
110
111test_expect_success 'cvsimport.module config works' '
112
113 cd module-git &&
114 git config cvsimport.module module &&
115 git cvsimport -a -z0 &&
116 git merge origin &&
117 cd .. &&
118 git diff module-cvs/tick module-git/tick
119
120'
121
122test_done