berry
berry copied to clipboard
[Bug?]: Changes to files with special characters in the name cause false positives in `yarn workspaces list --since`
Self-service
- [x] I'd be willing to implement a fix
Describe the bug
When a changed file has certain special characters in the name, yarn workspaces list --since will claim the root workspace has changes rather than the actual affected workspace.
When changed files contain certain special characters (e.g. "), git diff --name-only includes quotes around file names. To my understanding this is the command Yarn uses under the hood for this command. It seems this could be avoided by either:
- Unquoting these file names when they are present.
- Using
git diff --name-only -zto get results asNUL-separated rather than newline-separated.
To reproduce
I've attached a git repo bundled with git bundle:
example.bundle.gz
gunzip example.bundle.gz && git clone example.bundle.gz && cd examplegit checkout quoted && YARN_CHANGESET_BASE_REFS=master yarn workspaces list --recursive --since --json -v. Note that it shows changes in the root workspace.git checkout unquoted && YARN_CHANGESET_BASE_REFS=master yarn workspaces list --recursive --since --json -v. Note that it shows changes in thesampleworkspace.
In both cases, the only change is the addition of a new file in the workspace dir. In the quoted branch that file's name contains a ", whereas in the unquoted branch it does not.
Environment
System:
OS: Linux 6.12 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
CPU: (16) x64 AMD Ryzen 7 PRO 7840U w/ Radeon 780M Graphics
Binaries:
Node: 20.19.2 - /tmp/xfs-d5277bfe/node
Yarn: 4.9.1 - /tmp/xfs-d5277bfe/yarn
npm: 10.8.2 - ~/.nvm/versions/node/v20.19.2/bin/npm
Additional context
No response