Fixes 4108; remove hidden files in kustomize edit command to correctly mimic shell globbing behaviour (#4170)

* util and util_test corrected

* fixed behaviour of fsondisk with test updated

* glob behaviour fixed in fsnode

* removed commented code
This commit is contained in:
Mohd Bilal
2021-11-10 22:21:26 +05:30
committed by GitHub
parent 86fb408b2c
commit cb1cbbe044
6 changed files with 261 additions and 28 deletions

View File

@@ -88,7 +88,17 @@ func (fsOnDisk) Exists(name string) bool {
// Glob returns the list of matching files
func (fsOnDisk) Glob(pattern string) ([]string, error) {
return filepath.Glob(pattern)
var result []string
allFilePaths, err := filepath.Glob(pattern)
if err != nil {
return nil, err
}
if IsHiddenFilePath(pattern) {
result = allFilePaths
} else {
result = RemoveHiddenFiles(allFilePaths)
}
return result, nil
}
// IsDir delegates to os.Stat and FileInfo.IsDir