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

[Bug?]: yarn patch may generate a patch with extraneous files #6664

Open
1 task
jakub-g opened this issue Jan 24, 2025 · 0 comments
Open
1 task

[Bug?]: yarn patch may generate a patch with extraneous files #6664

jakub-g opened this issue Jan 24, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@jakub-g
Copy link

jakub-g commented Jan 24, 2025

Self-service

  • I'd be willing to implement a fix

Describe the bug

When doing yarn patch, it does a diff on disk between two folders, and everything found on disk will be included in the patch. The package.json#files field is not checked.

This may result in the patch containing more than the author patch had in mind. For example, certain auto-generated hidden files by the operating system may be included in the patch (notably .DS_store on MacOS).

This is problematic because then when reviewing a pull request with such patch, if it includes large binary data, such patch might be unreadable e.g. in GH UI, and may require fetching the branch locally and using a special tool for understanding contents of the patch

To reproduce

# start patching, this writes on disk to <path>
yarn patch <package>

# open <path> in MacOS Finder

# finalize the patch
yarn patch-commit -s <path>

Environment

MacOS

Additional context

  • Relevant code
  • After briefly discussing with @arcanis, the recommended approach would be to just exclude .DS_store files from the diff, and perhaps some other files like ~ files created by some text editors.
@jakub-g jakub-g added the bug Something isn't working label Jan 24, 2025
@jakub-g jakub-g changed the title [Bug?]: yarn patch may contain extraneous files [Bug?]: yarn patch may generate a patch with extraneous files Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant