Skip to content

Commit 8a78c6f

Browse files
authored
fix: only add directories we made to _sparseTreeRoots (#6222)
1 parent e4de224 commit 8a78c6f

File tree

1 file changed

+7
-2
lines changed
  • workspaces/arborist/lib/arborist

1 file changed

+7
-2
lines changed

workspaces/arborist/lib/arborist/reify.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,9 +535,14 @@ module.exports = cls => class Reifier extends cls {
535535
await this[_renamePath](d, retired)
536536
}
537537
}
538-
const made = await mkdir(node.path, { recursive: true })
539538
this[_sparseTreeDirs].add(node.path)
540-
this[_sparseTreeRoots].add(made)
539+
const made = await mkdir(node.path, { recursive: true })
540+
// if the directory already exists, made will be undefined. if that's the case
541+
// we don't want to remove it because we aren't the ones who created it so we
542+
// omit it from the _sparseTreeRoots
543+
if (made) {
544+
this[_sparseTreeRoots].add(made)
545+
}
541546
}))
542547
.then(() => process.emit('timeEnd', 'reify:createSparse'))
543548
}

0 commit comments

Comments
 (0)