berry icon indicating copy to clipboard operation
berry copied to clipboard

[Bug?]: Changes to files with special characters in the name cause false positives in `yarn workspaces list --since`

Open colatkinson opened this issue 7 months ago • 0 comments

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:

  1. Unquoting these file names when they are present.
  2. Using git diff --name-only -z to get results as NUL-separated rather than newline-separated.

To reproduce

I've attached a git repo bundled with git bundle: example.bundle.gz

  1. gunzip example.bundle.gz && git clone example.bundle.gz && cd example
  2. git checkout quoted && YARN_CHANGESET_BASE_REFS=master yarn workspaces list --recursive --since --json -v. Note that it shows changes in the root workspace.
  3. git checkout unquoted && YARN_CHANGESET_BASE_REFS=master yarn workspaces list --recursive --since --json -v. Note that it shows changes in the sample workspace.

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

colatkinson avatar May 21 '25 20:05 colatkinson