fix(fs): remove old target object from cache before updating #8352
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
当执行 Rename 并启用 Overwrite existing files 选项时,由于重命名的目标没有从缓存中删除,导致目录缓存中存在两个同名文件,因此列目录时(可能)看到的依然是旧文件。
本 PR 在更新缓存前从缓存中删除了旧的目标文件,以确保缓存正确性。
BTW,对于未勾选 Overwrite existing files 选项的情形,由于目标文件不存在,因而不会触发删除操作。