Move globIgnoredChildren guard before shouldDeleteUnknownInstances

The guard was placed after the early return, so when
ignoreUnknownInstances was false the function exited at line 39
before ever reaching the globIgnoredChildren check. Project nodes
and meta files can override ignoreUnknownInstances independently,
causing incorrect deletions of glob-ignored instances.
This commit is contained in:
Joe 2026-03-07 12:10:35 -06:00
parent 1406c1a1b7
commit 8772077ed1

View file

@ -35,17 +35,18 @@ local SCRIPT_CLASS_NAMES = {
}
local function shouldDeleteChild(virtualInstance, childInstance)
if shouldDeleteUnknownInstances(virtualInstance) then
return true
end
-- When the parent has glob-ignored children, suppress ALL deletions
-- (including scripts). This differs from scripts-only mode where
-- scripts are still eligible for deletion.
-- (including scripts) unconditionally. This must be checked before
-- shouldDeleteUnknownInstances because project nodes and meta files
-- can override ignoreUnknownInstances independently.
if virtualInstance.Metadata and virtualInstance.Metadata.globIgnoredChildren then
return false
end
if shouldDeleteUnknownInstances(virtualInstance) then
return true
end
-- In scripts-only mode (where parent has ignoreUnknownInstances: true),
-- we still want to allow deletion of scripts. This ensures deleted
-- script files show up in the sync diff.