Protect the main version inside item scopes
This commit is contained in:
@@ -230,7 +230,22 @@ func loadImportedWithAccessTrackedAndProcessingPolicy(access *filesystemAccess,
|
||||
return nil, cloneSourceInfos(state.sources), prependDiagnosticPaths(failures, destination.Index(0))
|
||||
}
|
||||
if versionState != nil {
|
||||
if diagnostic := importedVersionClaim(documents, completed, versionState.localRule, 0); diagnostic != nil {
|
||||
protectionRule := versionState.localRule
|
||||
if versionState.mode == sourceVersionModeDefault && protectionRule != nil {
|
||||
prefix := destination.Index(0)
|
||||
relative, inside := relativeHistoryPath(prefix, protectionRule.Path)
|
||||
if !inside || !matchesPathShape(Path{segments: protectionRule.Path.segments[:len(prefix.segments)]}, prefix) {
|
||||
protectionRule = nil
|
||||
} else {
|
||||
scoped := *protectionRule
|
||||
scoped.Path = relative
|
||||
protectionRule = &scoped
|
||||
}
|
||||
}
|
||||
if diagnostic := importedVersionClaim(documents, completed, protectionRule, 0); diagnostic != nil {
|
||||
if rule != nil {
|
||||
diagnostic.Path = rule.Path.clone()
|
||||
}
|
||||
return nil, cloneSourceInfos(state.sources), []Diagnostic{*diagnostic}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user