lib: Introduce fs.IsParent (fixes #5324) (#5326)

This commit is contained in:
Simon Frei
2018-11-22 11:16:45 +01:00
committed by Jakob Borg
parent 513d3bc374
commit 2f9840ddae
6 changed files with 19 additions and 11 deletions

View File

@@ -199,12 +199,11 @@ func NewFilesystem(fsType FilesystemType, uri string) Filesystem {
func IsInternal(file string) bool {
// fs cannot import config, so we hard code .stfolder here (config.DefaultMarkerName)
internals := []string{".stfolder", ".stignore", ".stversions"}
pathSep := string(PathSeparator)
for _, internal := range internals {
if file == internal {
return true
}
if strings.HasPrefix(file, internal+pathSep) {
if IsParent(file, internal) {
return true
}
}