Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: only add directories we made to _sparseTreeRoots #6222

Merged
merged 1 commit into from
Mar 8, 2023

Conversation

nlf
Copy link
Contributor

@nlf nlf commented Mar 2, 2023

when we changed from mkdirp to fs.mkdir we missed a breaking change in the underlying behavior. mkdirp returns the path it was asked to make, even if it doesn't create any directories. fs.mkdir on the other hand will return undefined if the directory already exists.

in order to not delete directories that we didn't create, we only add paths that we've created to the _sparseTreeRoots

@nlf nlf requested a review from a team as a code owner March 2, 2023 20:44
@nlf nlf requested review from wraithgar and removed request for a team March 2, 2023 20:44
Copy link
Contributor

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yay!

not that i want to delay this fix landing, but, tests?

@nlf nlf force-pushed the nlf/mdkir-fix branch from b02c561 to 729cfbb Compare March 2, 2023 21:01
@nlf nlf changed the title fix: fallback to node.path if fs.mkdir returns undefined fix: only add directories we made to _sparseTreeRoots Mar 2, 2023
@nlf
Copy link
Contributor Author

nlf commented Mar 2, 2023

not that i want to delay this fix landing, but, tests?

i'm trying to see if there's a reasonable way to add an assertion somewhere. we already have coverage on the line so there's that. if i can't sort out a reasonable test i think we're comfortable with this anyway

@lukekarrys lukekarrys merged commit 8a78c6f into latest Mar 8, 2023
@lukekarrys lukekarrys deleted the nlf/mdkir-fix branch March 8, 2023 17:34
@github-actions github-actions bot mentioned this pull request Mar 8, 2023
@github-actions github-actions bot mentioned this pull request Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants