Skip to content

Commit b225290

Browse files
mhaggergitster
authored andcommitted
Add some tests of git-cvsimport's handling of vendor branches
CVS's handling of vendor branches is tricky; add some tests to check whether revisions added via "cvs imports" then imported to git via "git cvsimport" are reflected correctly on master. One of these tests fail and is therefore marked "test_expect_failure". Cvsimport doesn't realize that subsequent changes on a vendor branch affect master as long as the vendor branch is the default branch. The test CVS repository used for these tests is derived from cvs2svn's test suite. Signed-off-by: Michael Haggerty <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent cefa318 commit b225290

File tree

9 files changed

+413
-0
lines changed

9 files changed

+413
-0
lines changed

t/t9601-cvsimport-vendor-branch.sh

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#!/bin/sh
2+
3+
# Description of the files in the repository:
4+
#
5+
# imported-once.txt:
6+
#
7+
# Imported once. 1.1 and 1.1.1.1 should be identical.
8+
#
9+
# imported-twice.txt:
10+
#
11+
# Imported twice. HEAD should reflect the contents of the
12+
# second import (i.e., have the same contents as 1.1.1.2).
13+
#
14+
# imported-modified.txt:
15+
#
16+
# Imported, then modified on HEAD. HEAD should reflect the
17+
# modification.
18+
#
19+
# imported-modified-imported.txt:
20+
#
21+
# Imported, then modified on HEAD, then imported again.
22+
#
23+
# added-imported.txt,v:
24+
#
25+
# Added with 'cvs add' to create 1.1, then imported with
26+
# completely different contents to create 1.1.1.1, therefore the
27+
# vendor branch was never the default branch.
28+
#
29+
# imported-anonymously.txt:
30+
#
31+
# Like imported-twice.txt, but with a vendor branch whose branch
32+
# tag has been removed.
33+
34+
test_description='git cvsimport handling of vendor branches'
35+
. ./lib-cvs.sh
36+
37+
CVSROOT="$TEST_DIRECTORY"/t9601/cvsroot
38+
export CVSROOT
39+
40+
test_expect_success 'import a module with a vendor branch' '
41+
42+
git cvsimport -C module-git module
43+
44+
'
45+
46+
test_expect_success 'check HEAD out of cvs repository' 'test_cvs_co master'
47+
48+
test_expect_success 'check master out of git repository' 'test_git_co master'
49+
50+
test_expect_success 'check a file that was imported once' '
51+
52+
test_cmp_branch_file master imported-once.txt
53+
54+
'
55+
56+
test_expect_failure 'check a file that was imported twice' '
57+
58+
test_cmp_branch_file master imported-twice.txt
59+
60+
'
61+
62+
test_expect_success 'check a file that was imported then modified on HEAD' '
63+
64+
test_cmp_branch_file master imported-modified.txt
65+
66+
'
67+
68+
test_expect_success 'check a file that was imported, modified, then imported again' '
69+
70+
test_cmp_branch_file master imported-modified-imported.txt
71+
72+
'
73+
74+
test_expect_success 'check a file that was added to HEAD then imported' '
75+
76+
test_cmp_branch_file master added-imported.txt
77+
78+
'
79+
80+
test_expect_success 'a vendor branch whose tag has been removed' '
81+
82+
test_cmp_branch_file master imported-anonymously.txt
83+
84+
'
85+
86+
test_done

t/t9601/cvsroot/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* -whitespace

t/t9601/cvsroot/CVSROOT/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
history
2+
val-tags
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
head 1.1;
2+
access;
3+
symbols
4+
vtag-4:1.1.1.1
5+
vbranchA:1.1.1;
6+
locks; strict;
7+
comment @# @;
8+
9+
10+
1.1
11+
date 2004.02.09.15.43.15; author kfogel; state Exp;
12+
branches
13+
1.1.1.1;
14+
next ;
15+
16+
1.1.1.1
17+
date 2004.02.09.15.43.16; author kfogel; state Exp;
18+
branches;
19+
next ;
20+
21+
22+
desc
23+
@@
24+
25+
26+
1.1
27+
log
28+
@Add a file to the working copy.
29+
@
30+
text
31+
@Adding this file, before importing it with different contents.
32+
@
33+
34+
35+
1.1.1.1
36+
log
37+
@Import (vbranchA, vtag-4).
38+
@
39+
text
40+
@d1 1
41+
a1 1
42+
This is vtag-4 (on vbranchA) of added-then-imported.txt.
43+
@
44+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
head 1.1;
2+
branch 1.1.1;
3+
access;
4+
symbols
5+
vtag-1:1.1.1.1;
6+
locks; strict;
7+
comment @# @;
8+
9+
10+
1.1
11+
date 2004.02.09.15.43.13; author kfogel; state Exp;
12+
branches
13+
1.1.1.1;
14+
next ;
15+
16+
1.1.1.1
17+
date 2004.02.09.15.43.13; author kfogel; state Exp;
18+
branches;
19+
next ;
20+
21+
22+
desc
23+
@@
24+
25+
26+
1.1
27+
log
28+
@Initial revision
29+
@
30+
text
31+
@This is vtag-1 (on vbranchA) of imported-anonymously.txt.
32+
@
33+
34+
35+
1.1.1.1
36+
log
37+
@Import (vbranchA, vtag-1).
38+
@
39+
text
40+
@@
41+
42+
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
head 1.2;
2+
access;
3+
symbols
4+
vtag-2:1.1.1.2
5+
vtag-1:1.1.1.1
6+
vbranchA:1.1.1;
7+
locks; strict;
8+
comment @# @;
9+
10+
11+
1.2
12+
date 2004.02.09.15.43.14; author kfogel; state Exp;
13+
branches;
14+
next 1.1;
15+
16+
1.1
17+
date 2004.02.09.15.43.13; author kfogel; state Exp;
18+
branches
19+
1.1.1.1;
20+
next ;
21+
22+
1.1.1.1
23+
date 2004.02.09.15.43.13; author kfogel; state Exp;
24+
branches;
25+
next 1.1.1.2;
26+
27+
1.1.1.2
28+
date 2004.02.09.15.43.13; author kfogel; state Exp;
29+
branches;
30+
next ;
31+
32+
33+
desc
34+
@@
35+
36+
37+
1.2
38+
log
39+
@First regular commit, to imported-modified-imported.txt, on HEAD.
40+
@
41+
text
42+
@This is a modification of imported-modified-imported.txt on HEAD.
43+
It should supersede the version from the vendor branch.
44+
@
45+
46+
47+
1.1
48+
log
49+
@Initial revision
50+
@
51+
text
52+
@d1 2
53+
a2 1
54+
This is vtag-1 (on vbranchA) of imported-modified-imported.txt.
55+
@
56+
57+
58+
1.1.1.1
59+
log
60+
@Import (vbranchA, vtag-1).
61+
@
62+
text
63+
@@
64+
65+
66+
1.1.1.2
67+
log
68+
@Import (vbranchA, vtag-2).
69+
@
70+
text
71+
@d1 1
72+
a1 1
73+
This is vtag-2 (on vbranchA) of imported-modified-imported.txt.
74+
@
75+
76+
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
head 1.2;
2+
access;
3+
symbols
4+
vtag-1:1.1.1.1
5+
vbranchA:1.1.1;
6+
locks; strict;
7+
comment @# @;
8+
9+
10+
1.2
11+
date 2004.02.09.15.43.14; author kfogel; state Exp;
12+
branches;
13+
next 1.1;
14+
15+
1.1
16+
date 2004.02.09.15.43.13; author kfogel; state Exp;
17+
branches
18+
1.1.1.1;
19+
next ;
20+
21+
1.1.1.1
22+
date 2004.02.09.15.43.13; author kfogel; state Exp;
23+
branches;
24+
next ;
25+
26+
27+
desc
28+
@@
29+
30+
31+
1.2
32+
log
33+
@Commit on HEAD.
34+
@
35+
text
36+
@This is a modification of imported-modified.txt on HEAD.
37+
It should supersede the version from the vendor branch.
38+
@
39+
40+
41+
1.1
42+
log
43+
@Initial revision
44+
@
45+
text
46+
@d1 2
47+
a2 1
48+
This is vtag-1 (on vbranchA) of imported-modified.txt.
49+
@
50+
51+
52+
1.1.1.1
53+
log
54+
@Import (vbranchA, vtag-1).
55+
@
56+
text
57+
@@
58+
59+
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
head 1.1;
2+
branch 1.1.1;
3+
access;
4+
symbols
5+
vtag-1:1.1.1.1
6+
vbranchA:1.1.1;
7+
locks; strict;
8+
comment @# @;
9+
10+
11+
1.1
12+
date 2004.02.09.15.43.13; author kfogel; state Exp;
13+
branches
14+
1.1.1.1;
15+
next ;
16+
17+
1.1.1.1
18+
date 2004.02.09.15.43.13; author kfogel; state Exp;
19+
branches;
20+
next ;
21+
22+
23+
desc
24+
@@
25+
26+
27+
1.1
28+
log
29+
@Initial revision
30+
@
31+
text
32+
@This is vtag-1 (on vbranchA) of imported-once.txt.
33+
@
34+
35+
36+
1.1.1.1
37+
log
38+
@Import (vbranchA, vtag-1).
39+
@
40+
text
41+
@@
42+
43+

0 commit comments

Comments
 (0)