@@ -221,3 +221,363 @@ load 'common'
221221 assert_equal " $( git -C git-repo show master:dir-a/.gitignore) " ' /ignore-a'
222222 assert git -C git-repo show master:dir-a/file-a
223223}
224+
225+ @test ' gitignore file should be removed if all svn-ignores are removed' {
226+ svn mkdir dir-a
227+ svn propset svn:ignore ' ignore-a' dir-a
228+ svn commit -m ' add dir-a'
229+ svn propset svn:ignore ' ' dir-a
230+ svn commit -m ' unignore ignore-a on dir-a'
231+
232+ cd " $TEST_TEMP_DIR "
233+ svn2git " $SVN_REPO " --svn-ignore --rules <( echo "
234+ create repository git-repo
235+ end repository
236+
237+ match /
238+ repository git-repo
239+ branch master
240+ end match
241+ " )
242+
243+ refute git -C git-repo show master:dir-a/.gitignore
244+ }
245+
246+ @test ' gitignore file should be removed if all svn-ignores are removed (nested)' {
247+ svn mkdir project-a
248+ cd project-a
249+ svn mkdir dir-a
250+ svn propset svn:ignore ' ignore-a' dir-a
251+ svn commit -m ' add dir-a'
252+ svn propset svn:ignore ' ' dir-a
253+ svn commit -m ' unignore ignore-a on dir-a'
254+
255+ cd " $TEST_TEMP_DIR "
256+ svn2git " $SVN_REPO " --svn-ignore --rules <( echo "
257+ create repository git-repo
258+ end repository
259+
260+ match /project-a/
261+ repository git-repo
262+ branch master
263+ end match
264+ " )
265+
266+ refute git -C git-repo show master:dir-a/.gitignore
267+ }
268+
269+ @test ' gitignore file should be removed if svn-ignore property is deleted' {
270+ svn mkdir dir-a
271+ svn propset svn:ignore ' ignore-a' dir-a
272+ svn commit -m ' add dir-a'
273+ svn propdel svn:ignore dir-a
274+ svn commit -m ' unignore ignore-a on dir-a'
275+
276+ cd " $TEST_TEMP_DIR "
277+ svn2git " $SVN_REPO " --svn-ignore --rules <( echo "
278+ create repository git-repo
279+ end repository
280+
281+ match /
282+ repository git-repo
283+ branch master
284+ end match
285+ " )
286+
287+ refute git -C git-repo show master:dir-a/.gitignore
288+ }
289+
290+ @test ' gitignore file should be removed if svn-ignore property is deleted (nested)' {
291+ svn mkdir project-a
292+ cd project-a
293+ svn mkdir dir-a
294+ svn propset svn:ignore ' ignore-a' dir-a
295+ svn commit -m ' add dir-a'
296+ svn propdel svn:ignore dir-a
297+ svn commit -m ' unignore ignore-a on dir-a'
298+
299+ cd " $TEST_TEMP_DIR "
300+ svn2git " $SVN_REPO " --svn-ignore --rules <( echo "
301+ create repository git-repo
302+ end repository
303+
304+ match /project-a/
305+ repository git-repo
306+ branch master
307+ end match
308+ " )
309+
310+ refute git -C git-repo show master:dir-a/.gitignore
311+ }
312+
313+ @test ' gitignore file should be removed if all svn-global-ignores are removed' {
314+ svn mkdir dir-a
315+ svn propset svn:global-ignores ' ignore-a' dir-a
316+ svn commit -m ' add dir-a'
317+ svn propset svn:global-ignores ' ' dir-a
318+ svn commit -m ' unignore ignore-a on dir-a and descendents'
319+
320+ cd " $TEST_TEMP_DIR "
321+ svn2git " $SVN_REPO " --svn-ignore --rules <( echo "
322+ create repository git-repo
323+ end repository
324+
325+ match /
326+ repository git-repo
327+ branch master
328+ end match
329+ " )
330+
331+ refute git -C git-repo show master:dir-a/.gitignore
332+ }
333+
334+ @test ' gitignore file should be removed if all svn-global-ignores are removed (nested)' {
335+ svn mkdir project-a
336+ cd project-a
337+ svn mkdir dir-a
338+ svn propset svn:global-ignores ' ignore-a' dir-a
339+ svn commit -m ' add dir-a'
340+ svn propset svn:global-ignores ' ' dir-a
341+ svn commit -m ' unignore ignore-a on dir-a and descendents'
342+
343+ cd " $TEST_TEMP_DIR "
344+ svn2git " $SVN_REPO " --svn-ignore --rules <( echo "
345+ create repository git-repo
346+ end repository
347+
348+ match /project-a/
349+ repository git-repo
350+ branch master
351+ end match
352+ " )
353+
354+ refute git -C git-repo show master:dir-a/.gitignore
355+ }
356+
357+ @test ' gitignore file should be removed if global-ignores property is deleted' {
358+ svn mkdir dir-a
359+ svn propset svn:global-ignores ' ignore-a' dir-a
360+ svn commit -m ' add dir-a'
361+ svn propdel svn:global-ignores dir-a
362+ svn commit -m ' unignore ignore-a on dir-a and descendents'
363+
364+ cd " $TEST_TEMP_DIR "
365+ svn2git " $SVN_REPO " --svn-ignore --rules <( echo "
366+ create repository git-repo
367+ end repository
368+
369+ match /
370+ repository git-repo
371+ branch master
372+ end match
373+ " )
374+
375+ refute git -C git-repo show master:dir-a/.gitignore
376+ }
377+
378+ @test ' gitignore file should be removed if global-ignores property is deleted (nested)' {
379+ svn mkdir project-a
380+ cd project-a
381+ svn mkdir dir-a
382+ svn propset svn:global-ignores ' ignore-a' dir-a
383+ svn commit -m ' add dir-a'
384+ svn propdel svn:global-ignores dir-a
385+ svn commit -m ' unignore ignore-a on dir-a and descendents'
386+
387+ cd " $TEST_TEMP_DIR "
388+ svn2git " $SVN_REPO " --svn-ignore --rules <( echo "
389+ create repository git-repo
390+ end repository
391+
392+ match /project-a/
393+ repository git-repo
394+ branch master
395+ end match
396+ " )
397+
398+ refute git -C git-repo show master:dir-a/.gitignore
399+ }
400+
401+ @test ' gitignore file should not be removed if global-ignores property is deleted but svn-ignore property is still present' {
402+ svn mkdir dir-a
403+ svn propset svn:ignore ' ignore-a' dir-a
404+ svn propset svn:global-ignores ' ignore-b' dir-a
405+ svn commit -m ' add dir-a'
406+ svn propdel svn:global-ignores dir-a
407+ svn commit -m ' unignore ignore-b on dir-a and descendents'
408+
409+ cd " $TEST_TEMP_DIR "
410+ svn2git " $SVN_REPO " --svn-ignore --rules <( echo "
411+ create repository git-repo
412+ end repository
413+
414+ match /
415+ repository git-repo
416+ branch master
417+ end match
418+ " )
419+
420+ assert_equal " $( git -C git-repo show master:dir-a/.gitignore) " ' /ignore-a'
421+ }
422+
423+ @test ' gitignore file should not be removed if global-ignores property is deleted but svn-ignore property is still present (nested)' {
424+ svn mkdir project-a
425+ cd project-a
426+ svn mkdir dir-a
427+ svn propset svn:ignore ' ignore-a' dir-a
428+ svn propset svn:global-ignores ' ignore-b' dir-a
429+ svn commit -m ' add dir-a'
430+ svn propdel svn:global-ignores dir-a
431+ svn commit -m ' unignore ignore-b on dir-a and descendents'
432+
433+ cd " $TEST_TEMP_DIR "
434+ svn2git " $SVN_REPO " --svn-ignore --rules <( echo "
435+ create repository git-repo
436+ end repository
437+
438+ match /project-a/
439+ repository git-repo
440+ branch master
441+ end match
442+ " )
443+
444+ assert_equal " $( git -C git-repo show master:dir-a/.gitignore) " ' /ignore-a'
445+ }
446+
447+ @test ' gitignore file should not be removed if svn-ignore property is deleted but global-ignores property is still present' {
448+ svn mkdir dir-a
449+ svn propset svn:ignore ' ignore-a' dir-a
450+ svn propset svn:global-ignores ' ignore-b' dir-a
451+ svn commit -m ' add dir-a'
452+ svn propdel svn:ignore dir-a
453+ svn commit -m ' unignore ignore-a on dir-a'
454+
455+ cd " $TEST_TEMP_DIR "
456+ svn2git " $SVN_REPO " --svn-ignore --rules <( echo "
457+ create repository git-repo
458+ end repository
459+
460+ match /
461+ repository git-repo
462+ branch master
463+ end match
464+ " )
465+
466+ assert_equal " $( git -C git-repo show master:dir-a/.gitignore) " ' ignore-b'
467+ }
468+
469+ @test ' gitignore file should not be removed if svn-ignore property is deleted but global-ignores property is still present (nested)' {
470+ svn mkdir project-a
471+ cd project-a
472+ svn mkdir dir-a
473+ svn propset svn:ignore ' ignore-a' dir-a
474+ svn propset svn:global-ignores ' ignore-b' dir-a
475+ svn commit -m ' add dir-a'
476+ svn propdel svn:ignore dir-a
477+ svn commit -m ' unignore ignore-a on dir-a'
478+
479+ cd " $TEST_TEMP_DIR "
480+ svn2git " $SVN_REPO " --svn-ignore --rules <( echo "
481+ create repository git-repo
482+ end repository
483+
484+ match /project-a/
485+ repository git-repo
486+ branch master
487+ end match
488+ " )
489+
490+ assert_equal " $( git -C git-repo show master:dir-a/.gitignore) " ' ignore-b'
491+ }
492+
493+ @test ' gitignore file should remain empty if svn-ignore property is deleted but empty-dirs is used' {
494+ svn mkdir dir-a
495+ svn propset svn:ignore ' ignore-a' dir-a
496+ svn commit -m ' add dir-a'
497+ svn propdel svn:ignore dir-a
498+ svn commit -m ' unignore ignore-a on dir-a'
499+
500+ cd " $TEST_TEMP_DIR "
501+ svn2git " $SVN_REPO " --svn-ignore --empty-dirs --rules <( echo "
502+ create repository git-repo
503+ end repository
504+
505+ match /
506+ repository git-repo
507+ branch master
508+ end match
509+ " )
510+
511+ assert git -C git-repo show master:dir-a/.gitignore
512+ assert_equal " $( git -C git-repo show master:dir-a/.gitignore) " ' '
513+ }
514+
515+ @test ' gitignore file should remain empty if svn-ignore property is deleted but empty-dirs is used (nested)' {
516+ svn mkdir project-a
517+ cd project-a
518+ svn mkdir dir-a
519+ svn propset svn:ignore ' ignore-a' dir-a
520+ svn commit -m ' add dir-a'
521+ svn propdel svn:ignore dir-a
522+ svn commit -m ' unignore ignore-a on dir-a'
523+
524+ cd " $TEST_TEMP_DIR "
525+ svn2git " $SVN_REPO " --svn-ignore --empty-dirs --rules <( echo "
526+ create repository git-repo
527+ end repository
528+
529+ match /project-a/
530+ repository git-repo
531+ branch master
532+ end match
533+ " )
534+
535+ assert git -C git-repo show master:dir-a/.gitignore
536+ assert_equal " $( git -C git-repo show master:dir-a/.gitignore) " ' '
537+ }
538+
539+ @test ' gitignore file should remain empty if global-ignores property is deleted but empty-dirs is used' {
540+ svn mkdir dir-a
541+ svn propset svn:global-ignores ' ignore-a' dir-a
542+ svn commit -m ' add dir-a'
543+ svn propdel svn:global-ignores dir-a
544+ svn commit -m ' unignore ignore-a on dir-a and descendents'
545+
546+ cd " $TEST_TEMP_DIR "
547+ svn2git " $SVN_REPO " --svn-ignore --empty-dirs --rules <( echo "
548+ create repository git-repo
549+ end repository
550+
551+ match /
552+ repository git-repo
553+ branch master
554+ end match
555+ " )
556+
557+ assert git -C git-repo show master:dir-a/.gitignore
558+ assert_equal " $( git -C git-repo show master:dir-a/.gitignore) " ' '
559+ }
560+
561+ @test ' gitignore file should remain empty if global-ignores property is deleted but empty-dirs is used (nested)' {
562+ svn mkdir project-a
563+ cd project-a
564+ svn mkdir dir-a
565+ svn propset svn:global-ignores ' ignore-a' dir-a
566+ svn commit -m ' add dir-a'
567+ svn propdel svn:global-ignores dir-a
568+ svn commit -m ' unignore ignore-a on dir-a and descendents'
569+
570+ cd " $TEST_TEMP_DIR "
571+ svn2git " $SVN_REPO " --svn-ignore --empty-dirs --rules <( echo "
572+ create repository git-repo
573+ end repository
574+
575+ match /project-a/
576+ repository git-repo
577+ branch master
578+ end match
579+ " )
580+
581+ assert git -C git-repo show master:dir-a/.gitignore
582+ assert_equal " $( git -C git-repo show master:dir-a/.gitignore) " ' '
583+ }
0 commit comments