Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions pkg/devspace/sync/downstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,19 @@ func (d *downstream) evaluateFile(fileline string, createFiles *[]*fileInformati
// File found don't delete it
delete(removeFiles, fileInformation.Name)

// Update mode, gid & uid if exists
if d.config.fileIndex.fileMap[fileInformation.Name] != nil {
d.config.fileIndex.fileMap[fileInformation.Name].RemoteMode = fileInformation.RemoteMode
d.config.fileIndex.fileMap[fileInformation.Name].RemoteGID = fileInformation.RemoteGID
d.config.fileIndex.fileMap[fileInformation.Name].RemoteUID = fileInformation.RemoteUID
}

// Exclude symlinks
if fileInformation.IsSymbolicLink {
// Add them to the fileMap though
d.config.fileIndex.fileMap[fileInformation.Name] = fileInformation
}

// Should we download the file / folder?
if shouldDownload(fileInformation, d.config) {
*createFiles = append(*createFiles, fileInformation)
Expand Down
30 changes: 5 additions & 25 deletions pkg/devspace/sync/evaluater.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,11 @@ func shouldUpload(relativePath string, stat os.FileInfo, s *SyncConfig, isInitia
}

// Exclude changes on the upload exclude list
if s.uploadIgnoreMatcher != nil {
if s.uploadIgnoreMatcher.MatchesPath(relativePath) {
// Add to file map and prevent download if local file is newer than the remote one
if s.fileIndex.fileMap[relativePath] != nil && s.fileIndex.fileMap[relativePath].Mtime < ceilMtime(stat.ModTime()) {
// Add it to the fileMap
s.fileIndex.fileMap[relativePath] = &fileInformation{
Name: relativePath,
Mtime: ceilMtime(stat.ModTime()),
Size: stat.Size(),
IsDirectory: stat.IsDir(),
}
}

return false
}
}
// if s.uploadIgnoreMatcher != nil {
// if s.uploadIgnoreMatcher.MatchesPath(relativePath) {
// return false
// }
// }

// Exclude local symlinks
if stat.Mode()&os.ModeSymlink != 0 {
Expand Down Expand Up @@ -109,13 +98,6 @@ func shouldDownload(fileInformation *fileInformation, s *SyncConfig) bool {
}
}

// Update mode, gid & uid if exists
if s.fileIndex.fileMap[fileInformation.Name] != nil {
s.fileIndex.fileMap[fileInformation.Name].RemoteMode = fileInformation.RemoteMode
s.fileIndex.fileMap[fileInformation.Name].RemoteGID = fileInformation.RemoteGID
s.fileIndex.fileMap[fileInformation.Name].RemoteUID = fileInformation.RemoteUID
}

// Exclude files on the exclude list
if s.downloadIgnoreMatcher != nil {
if s.downloadIgnoreMatcher.MatchesPath(fileInformation.Name) {
Expand All @@ -125,8 +107,6 @@ func shouldDownload(fileInformation *fileInformation, s *SyncConfig) bool {

// Exclude symlinks
if fileInformation.IsSymbolicLink {
// Add them to the fileMap though
s.fileIndex.fileMap[fileInformation.Name] = fileInformation
return false
}

Expand Down
18 changes: 18 additions & 0 deletions pkg/devspace/sync/sync_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,24 @@ func (s *SyncConfig) diffServerClient(filepath string, sendChanges *[]*fileInfor
delete(downloadChanges, relativePath)

s.fileIndex.fileMapMutex.Lock()
// Exclude changes on the upload exclude list
if s.uploadIgnoreMatcher != nil {
if s.uploadIgnoreMatcher.MatchesPath(relativePath) {
// Add to file map and prevent download if local file is newer than the remote one
if s.fileIndex.fileMap[relativePath] != nil && s.fileIndex.fileMap[relativePath].Mtime < ceilMtime(stat.ModTime()) {
// Add it to the fileMap
s.fileIndex.fileMap[relativePath] = &fileInformation{
Name: relativePath,
Mtime: ceilMtime(stat.ModTime()),
Size: stat.Size(),
IsDirectory: stat.IsDir(),
}
}

return nil
}
}

shouldUpload := shouldUpload(relativePath, stat, s, true)
s.fileIndex.fileMapMutex.Unlock()

Expand Down
18 changes: 18 additions & 0 deletions pkg/devspace/sync/upstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,24 @@ func evaluateChange(s *SyncConfig, fileMap map[string]*fileInformation, relative
// File / Folder exist -> Create File or Folder
// if File / Folder does not exist, we create a new remove change
if err == nil {
// Exclude changes on the upload exclude list
if s.uploadIgnoreMatcher != nil {
if s.uploadIgnoreMatcher.MatchesPath(relativePath) {
// Add to file map and prevent download if local file is newer than the remote one
if s.fileIndex.fileMap[relativePath] != nil && s.fileIndex.fileMap[relativePath].Mtime < ceilMtime(stat.ModTime()) {
// Add it to the fileMap
s.fileIndex.fileMap[relativePath] = &fileInformation{
Name: relativePath,
Mtime: ceilMtime(stat.ModTime()),
Size: stat.Size(),
IsDirectory: stat.IsDir(),
}
}

return nil
}
}

if shouldUpload(relativePath, stat, s, false) {
// New Create Task
return &fileInformation{
Expand Down