@@ -431,50 +431,46 @@ Or you can go back to the classic croc behavior by enabling classic mode:
431
431
if err != nil {
432
432
return
433
433
}
434
- minimalFileInfosInclude := []croc.FileInfo {}
435
- exclusions := []string {}
436
- for _ , exclude := range crocOptions .Exclude {
437
- exclusions = append (exclusions , strings .ToLower (exclude ))
438
- }
439
- for _ , f := range minimalFileInfos {
440
- exclude := false
441
- for _ , exclusion := range exclusions {
442
- if strings .Contains (path .Join (strings .ToLower (f .FolderRemote ), strings .ToLower (f .Name )), exclusion ) {
443
- exclude = true
444
- break
434
+ if len (crocOptions .Exclude ) > 0 {
435
+ minimalFileInfosInclude := []croc.FileInfo {}
436
+ emptyFoldersToTransferInclude := []croc.FileInfo {}
437
+ for _ , f := range minimalFileInfos {
438
+ exclude := false
439
+ for _ , exclusion := range crocOptions .Exclude {
440
+ if strings .Contains (path .Join (strings .ToLower (f .FolderRemote ), strings .ToLower (f .Name )), exclusion ) {
441
+ exclude = true
442
+ break
443
+ }
444
+ }
445
+ if ! exclude {
446
+ minimalFileInfosInclude = append (minimalFileInfosInclude , f )
445
447
}
446
448
}
447
- if ! exclude {
448
- minimalFileInfosInclude = append (minimalFileInfosInclude , f )
449
- }
450
- }
451
- emptyFoldersToTransferInclude := []croc.FileInfo {}
452
- for _ , f := range emptyFoldersToTransfer {
453
- exclude := false
454
- for _ , exclusion := range exclusions {
455
- if strings .Contains (path .Join (strings .ToLower (f .FolderRemote ), strings .ToLower (f .Name )), exclusion ) {
456
- exclude = true
457
- break
449
+ for _ , f := range emptyFoldersToTransfer {
450
+ exclude := false
451
+ for _ , exclusion := range crocOptions .Exclude {
452
+ if strings .Contains (path .Join (strings .ToLower (f .FolderRemote ), strings .ToLower (f .Name )), exclusion ) {
453
+ exclude = true
454
+ break
455
+ }
456
+ }
457
+ if ! exclude {
458
+ emptyFoldersToTransferInclude = append (emptyFoldersToTransferInclude , f )
458
459
}
459
460
}
460
- if ! exclude {
461
- emptyFoldersToTransferInclude = append (emptyFoldersToTransferInclude , f )
461
+ totalNumberFolders = 0
462
+ folderMap := make (map [string ]bool )
463
+ for _ , f := range minimalFileInfosInclude {
464
+ folderMap [f .FolderRemote ] = true
462
465
}
466
+ for _ , f := range emptyFoldersToTransferInclude {
467
+ folderMap [f .FolderRemote ] = true
468
+ }
469
+ totalNumberFolders = len (folderMap )
470
+ minimalFileInfos = minimalFileInfosInclude
471
+ emptyFoldersToTransfer = emptyFoldersToTransferInclude
463
472
}
464
473
465
- totalNumberFolders = 0
466
- folderMap := make (map [string ]bool )
467
- for _ , f := range minimalFileInfosInclude {
468
- folderMap [f .FolderRemote ] = true
469
- log .Tracef ("zxvc file: %+v" , f )
470
- // is folder
471
- }
472
- for _ , f := range emptyFoldersToTransferInclude {
473
- log .Tracef ("zxvc folder: %+v" , f )
474
- }
475
- totalNumberFolders = len (folderMap )
476
- log .Debugf ("zxvc total number of folders: %d" , totalNumberFolders )
477
-
478
474
cr , err := croc .New (crocOptions )
479
475
if err != nil {
480
476
return
@@ -483,7 +479,7 @@ Or you can go back to the classic croc behavior by enabling classic mode:
483
479
// save the config
484
480
saveConfig (c , crocOptions )
485
481
486
- err = cr .Send (minimalFileInfosInclude , emptyFoldersToTransferInclude , totalNumberFolders )
482
+ err = cr .Send (minimalFileInfos , emptyFoldersToTransfer , totalNumberFolders )
487
483
488
484
return
489
485
}
0 commit comments