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

Drop support for checking object with path property in function returns by isGitIgnored #208

Merged
merged 3 commits into from Jan 17, 2022

Conversation

fisker
Copy link
Collaborator

@fisker fisker commented Jan 17, 2022

Ref: #207 (comment)

This behavior is never documented.

@fisker fisker marked this pull request as draft January 17, 2022 09:16
@fisker
Copy link
Collaborator Author

fisker commented Jan 17, 2022

I found other bugs...

@@ -34,7 +34,7 @@ const checkCwdOption = options => {
}
};

const getPathString = p => p.stats instanceof fs.Stats ? p.path : p;
const getPathString = fastGlobResult => fastGlobResult.path || fastGlobResult;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This function mean to handle fastGlobResult, but p.stats is not always true, see objectMode option in fast-glob

@@ -152,7 +152,7 @@ export const globby = async (patterns, options = {}) => {
const [filter, tasks] = await Promise.all([getFilter(options), getTasks()]);
const paths = await Promise.all(tasks.map(task => fastGlob(task.pattern, task.options)));

return arrayUnion(...paths).filter(path_ => !filter(getPathString(path_)));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

filter already handles objectMode result, not needed here, globbySync and globbyStream also not doing this.

@fisker fisker marked this pull request as ready for review January 17, 2022 09:34
@fisker
Copy link
Collaborator Author

fisker commented Jan 17, 2022

This one is ready, but I saw another bug here, the arrayUnion is not used correctly, when use fastGlob with objectMode, arrayUnion can't work, we should implement a function to unique the fastGlob result my path, I'll send another PR.

@sindresorhus sindresorhus merged commit 7833ad5 into sindresorhus:main Jan 17, 2022
@sindresorhus
Copy link
Owner

Thanks for catching these bugs. I really appreciate it.

@fisker fisker deleted the is-git-ignored-path branch January 17, 2022 09:43
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.

None yet

2 participants