]> git.ipfire.org Git - thirdparty/git.git/blame - t/t9600-cvsimport.sh
Merge branch 'cb/maint-unpack-trees-absense' into maint
[thirdparty/git.git] / t / t9600-cvsimport.sh
CommitLineData
795c7c0b
JK
1#!/bin/sh
2
f964732c 3test_description='git cvsimport basic tests'
795c7c0b
JK
4. ./test-lib.sh
5
40ae8872
FL
6CVSROOT=$(pwd)/cvsroot
7export CVSROOT
374488f3 8unset CVS_SERVER
40ae8872
FL
9# for clean cvsps cache
10HOME=$(pwd)
11export HOME
12
dcbcb707 13if ! type cvs >/dev/null 2>&1
795c7c0b 14then
dcbcb707 15 say 'skipping cvsimport tests, cvs not found'
795c7c0b
JK
16 test_done
17 exit
18fi
19
dcbcb707
JK
20cvsps_version=`cvsps -h 2>&1 | sed -ne 's/cvsps version //p'`
21case "$cvsps_version" in
a271b2a9 222.1 | 2.2*)
dcbcb707
JK
23 ;;
24'')
25 say 'skipping cvsimport tests, cvsps not found'
26 test_done
27 exit
28 ;;
29*)
a271b2a9 30 say 'skipping cvsimport tests, unsupported cvsps version'
dcbcb707
JK
31 test_done
32 exit
33 ;;
34esac
35
795c7c0b
JK
36test_expect_success 'setup cvsroot' 'cvs init'
37
38test_expect_success 'setup a cvs module' '
39
f69e836f 40 mkdir "$CVSROOT/module" &&
795c7c0b
JK
41 cvs co -d module-cvs module &&
42 cd module-cvs &&
43 cat <<EOF >o_fortuna &&
44O Fortuna
45velut luna
46statu variabilis,
47
48semper crescis
49aut decrescis;
50vita detestabilis
51
52nunc obdurat
53et tunc curat
54ludo mentis aciem,
55
56egestatem,
57potestatem
58dissolvit ut glaciem.
59EOF
60 cvs add o_fortuna &&
61 cat <<EOF >message &&
62add "O Fortuna" lyrics
63
64These public domain lyrics make an excellent sample text.
65EOF
66 cvs commit -F message &&
67 cd ..
68'
69
70test_expect_success 'import a trivial module' '
71
72 git cvsimport -a -z 0 -C module-git module &&
3af82863 73 test_cmp module-cvs/o_fortuna module-git/o_fortuna
795c7c0b
JK
74
75'
76
9da0dabc
JK
77test_expect_success 'pack refs' 'cd module-git && git gc && cd ..'
78
795c7c0b
JK
79test_expect_success 'update cvs module' '
80
81 cd module-cvs &&
82 cat <<EOF >o_fortuna &&
83O Fortune,
84like the moon
85you are changeable,
86
87ever waxing
88and waning;
89hateful life
90
91first oppresses
92and then soothes
93as fancy takes it;
94
95poverty
96and power
97it melts them like ice.
98EOF
99 cat <<EOF >message &&
100translate to English
101
102My Latin is terrible.
103EOF
104 cvs commit -F message &&
105 cd ..
106'
107
108test_expect_success 'update git module' '
109
110 cd module-git &&
111 git cvsimport -a -z 0 module &&
112 git merge origin &&
113 cd .. &&
3af82863 114 test_cmp module-cvs/o_fortuna module-git/o_fortuna
795c7c0b
JK
115
116'
117
67d23242
JK
118test_expect_success 'update cvs module' '
119
120 cd module-cvs &&
121 echo 1 >tick &&
122 cvs add tick &&
123 cvs commit -m 1
124 cd ..
125
126'
127
128test_expect_success 'cvsimport.module config works' '
129
130 cd module-git &&
131 git config cvsimport.module module &&
132 git cvsimport -a -z0 &&
133 git merge origin &&
134 cd .. &&
3af82863 135 test_cmp module-cvs/tick module-git/tick
67d23242
JK
136
137'
138
4e596e98
JK
139test_expect_success 'import from a CVS working tree' '
140
141 cvs co -d import-from-wt module &&
142 cd import-from-wt &&
143 git cvsimport -a -z0 &&
144 echo 1 >expect &&
145 git log -1 --pretty=format:%s%n >actual &&
3af82863 146 test_cmp actual expect &&
4e596e98
JK
147 cd ..
148
149'
150
795c7c0b 151test_done