11package sync
22
33import (
4+ "github.com/loft-sh/devspace/pkg/util/log"
45 "os"
56
67 "github.com/loft-sh/devspace/helper/remote"
@@ -36,7 +37,7 @@ func shouldRemoveRemote(relativePath string, s *Sync) bool {
3637}
3738
3839// s.fileIndex needs to be locked before this function is called
39- func shouldUpload (s * Sync , fileInformation * FileInformation ) bool {
40+ func shouldUpload (s * Sync , fileInformation * FileInformation , log log. Logger ) bool {
4041 // Exclude if stat is nil
4142 if fileInformation == nil {
4243 return false
@@ -50,12 +51,14 @@ func shouldUpload(s *Sync, fileInformation *FileInformation) bool {
5051
5152 // Exclude local symlinks
5253 if fileInformation .IsSymbolicLink {
54+ log .Debugf ("Don't upload %s because it is a symbolic link" , fileInformation .Name )
5355 return false
5456 }
5557
5658 // Exclude changes on the exclude list
5759 if s .ignoreMatcher != nil {
5860 if s .ignoreMatcher .Matches (fileInformation .Name , fileInformation .IsDirectory ) {
61+ log .Debugf ("Don't upload %s because it is excluded" , fileInformation .Name )
5962 return false
6063 }
6164 }
@@ -64,16 +67,19 @@ func shouldUpload(s *Sync, fileInformation *FileInformation) bool {
6467 if s .fileIndex .fileMap [fileInformation .Name ] != nil {
6568 // Folder already exists, don't send change
6669 if fileInformation .IsDirectory {
70+ log .Debugf ("Don't upload %s because directory already exists" , fileInformation .Name )
6771 return false
6872 }
6973
7074 // Exclude symlinks
7175 if s .fileIndex .fileMap [fileInformation .Name ].IsSymbolicLink {
76+ log .Debugf ("Don't upload %s because it is a symbolic link" , fileInformation .Name )
7277 return false
7378 }
7479
7580 // File did not change or was changed by downstream
7681 if fileInformation .Mtime == s .fileIndex .fileMap [fileInformation .Name ].Mtime && fileInformation .Size == s .fileIndex .fileMap [fileInformation .Name ].Size {
82+ log .Debugf ("Don't upload %s because mtime and size have not changed" , fileInformation .Name )
7783 return false
7884 }
7985 }
0 commit comments