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