@@ -25,6 +25,33 @@ load 'common'
2525 ) "
2626}
2727
28+ @test ' svn:ignore entries should only ignore matching direct children (nested)' {
29+ svn mkdir project-a
30+ cd project-a
31+ svn mkdir dir-a
32+ svn commit -m ' add dir-a'
33+ svn update
34+ svn propset svn:ignore $' ignore-a\n ignore-b' dir-a
35+ svn commit -m ' ignore ignore-a and ignore-b on dir-a'
36+
37+ cd " $TEST_TEMP_DIR "
38+ svn2git " $SVN_REPO " --svn-ignore --rules <( echo "
39+ create repository git-repo
40+ end repository
41+
42+ match /project-a/
43+ repository git-repo
44+ branch master
45+ end match
46+ " )
47+
48+ assert_equal " $( git -C git-repo show master:dir-a/.gitignore) " " $( cat << -EOF
49+ /ignore-a
50+ /ignore-b
51+ EOF
52+ ) "
53+ }
54+
2855@test ' svn:global-ignores entries should ignore all matching descendents' {
2956 svn mkdir dir-a
3057 svn commit -m ' add dir-a'
@@ -50,6 +77,33 @@ load 'common'
5077 ) "
5178}
5279
80+ @test ' svn:global-ignores entries should ignore all matching descendents (nested)' {
81+ svn mkdir project-a
82+ cd project-a
83+ svn mkdir dir-a
84+ svn commit -m ' add dir-a'
85+ svn update
86+ svn propset svn:global-ignores $' ignore-a\n ignore-b' dir-a
87+ svn commit -m ' ignore ignore-a and ignore-b on dir-a and descendents'
88+
89+ cd " $TEST_TEMP_DIR "
90+ svn2git " $SVN_REPO " --svn-ignore --rules <( echo "
91+ create repository git-repo
92+ end repository
93+
94+ match /project-a/
95+ repository git-repo
96+ branch master
97+ end match
98+ " )
99+
100+ assert_equal " $( git -C git-repo show master:dir-a/.gitignore) " " $( cat << -EOF
101+ ignore-a
102+ ignore-b
103+ EOF
104+ ) "
105+ }
106+
53107@test ' svn-ignore translation should be done if svn-branches parameter is used' {
54108 svn mkdir trunk
55109 svn commit -m ' create trunk'
@@ -95,6 +149,53 @@ load 'common'
95149 ) "
96150}
97151
152+ @test ' svn-ignore translation should be done if svn-branches parameter is used (nested)' {
153+ svn mkdir project-a
154+ cd project-a
155+ svn mkdir trunk
156+ svn commit -m ' create trunk'
157+ svn propset svn:ignore $' ignore-a\n ignore-b' trunk
158+ svn commit -m ' ignore ignore-a and ignore-b on root'
159+ svn propset svn:global-ignores ' ignore-c' trunk
160+ svn commit -m ' ignore ignore-c everywhere'
161+ svn mkdir branches
162+ svn copy trunk branches/branch-a
163+ svn commit -m ' create branch branch-a'
164+
165+ cd " $TEST_TEMP_DIR "
166+ svn2git " $SVN_REPO " --svn-ignore --svn-branches --rules <( echo "
167+ create repository git-repo
168+ end repository
169+
170+ match /project-a/trunk/
171+ repository git-repo
172+ branch master
173+ end match
174+
175+ match /project-a/branches/([^/]+)/
176+ repository git-repo
177+ branch \1
178+ end match
179+
180+ match /project-a/(branches/)?$
181+ action recurse
182+ end match
183+ " )
184+
185+ assert_equal " $( git -C git-repo show master:.gitignore) " " $( cat << -EOF
186+ /ignore-a
187+ /ignore-b
188+ ignore-c
189+ EOF
190+ ) "
191+ assert_equal " $( git -C git-repo show branch-a:.gitignore) " " $( cat << -EOF
192+ /ignore-a
193+ /ignore-b
194+ ignore-c
195+ EOF
196+ ) "
197+ }
198+
98199@test ' svn-ignore translation should be done transitively when copying a directory' {
99200 svn mkdir --parents dir-a/subdir-a
100201 svn commit -m ' add dir-a/subdir-a'
@@ -130,6 +231,43 @@ load 'common'
130231 ) "
131232}
132233
234+ @test ' svn-ignore translation should be done transitively when copying a directory (nested)' {
235+ svn mkdir project-a
236+ cd project-a
237+ svn mkdir --parents dir-a/subdir-a
238+ svn commit -m ' add dir-a/subdir-a'
239+ svn propset svn:ignore $' ignore-a\n ignore-b' dir-a/subdir-a
240+ svn commit -m ' ignore ignore-a and ignore-b on dir-a/subdir-a'
241+ svn propset svn:global-ignores ' ignore-c' dir-a/subdir-a
242+ svn commit -m ' ignore ignore-c on dir-a/subdir-a and descendents'
243+ svn copy dir-a dir-b
244+ svn commit -m ' copy dir-a to dir-b'
245+
246+ cd " $TEST_TEMP_DIR "
247+ svn2git " $SVN_REPO " --svn-ignore --rules <( echo "
248+ create repository git-repo
249+ end repository
250+
251+ match /project-a/
252+ repository git-repo
253+ branch master
254+ end match
255+ " )
256+
257+ assert_equal " $( git -C git-repo show master:dir-a/subdir-a/.gitignore) " " $( cat << -EOF
258+ /ignore-a
259+ /ignore-b
260+ ignore-c
261+ EOF
262+ ) "
263+ assert_equal " $( git -C git-repo show master:dir-b/subdir-a/.gitignore) " " $( cat << -EOF
264+ /ignore-a
265+ /ignore-b
266+ ignore-c
267+ EOF
268+ ) "
269+ }
270+
133271@test ' svn-ignore parameter should not cause added directories to be dumped multiple times' {
134272 svn mkdir dir-a
135273 echo content-a > dir-a/file-a
0 commit comments