Skip to content

Commit e7e1634

Browse files
committed
fix: allow !/.git excludes
1 parent 661d6ba commit e7e1634

2 files changed

Lines changed: 20 additions & 6 deletions

File tree

pkg/devspace/config/loader/validate.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,21 @@ func validateDevContainer(path string, devContainer *latest.DevContainer, nameRe
362362
}
363363
}
364364
}
365+
for j, p := range sync.ExcludePaths {
366+
if p == "" {
367+
return errors.Errorf("%s.sync[%d].excludePaths[%d] is empty. This can happen if you use !path without quotes like this: '!path'", path, index, j)
368+
}
369+
}
370+
for j, p := range sync.UploadExcludePaths {
371+
if p == "" {
372+
return errors.Errorf("%s.sync[%d].uploadExcludePaths[%d] is empty. This can happen if you use !path without quotes like this: '!path'", path, index, j)
373+
}
374+
}
375+
for j, p := range sync.DownloadExcludePaths {
376+
if p == "" {
377+
return errors.Errorf("%s.sync[%d].downloadExcludePaths[%d] is empty. This can happen if you use !path without quotes like this: '!path'", path, index, j)
378+
}
379+
}
365380
}
366381
for index, port := range devContainer.ReversePorts {
367382
if port.Port == "" {

pkg/devspace/sync/sync.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,12 @@ func NewSync(ctx context.Context, localPath string, options Options) (*Sync, err
108108
return nil, errors.Wrap(err, "eval symlinks")
109109
}
110110

111-
if options.ExcludePaths == nil {
112-
options.ExcludePaths = []string{}
113-
}
114-
115111
// We exclude the sync log to prevent an endless loop in upstream
116-
options.ExcludePaths = append(options.ExcludePaths, ".devspace/")
117-
options.ExcludePaths = append(options.ExcludePaths, ".git/")
112+
newExcludes := []string{}
113+
newExcludes = append(newExcludes, ".devspace/")
114+
newExcludes = append(newExcludes, ".git/")
115+
newExcludes = append(newExcludes, options.ExcludePaths...)
116+
options.ExcludePaths = newExcludes
118117

119118
// Create sync structure
120119
s := &Sync{

0 commit comments

Comments
 (0)