Skip to content

fix(git): keep special-character paths from git name-only listings - #7276

Open
r3wretrhy wants to merge 1 commit into
yarnpkg:masterfrom
r3wretrhy:fix-git-name-only-quoting
Open

r3wretrhy wants to merge 1 commit into
yarnpkg:masterfrom
r3wretrhy:fix-git-name-only-quoting

Conversation

@r3wretrhy

Copy link
Copy Markdown

fix(git): keep special-character paths from git name-only listings

git diff --name-only and git ls-files --others C-quote paths that contain " or non-ASCII when core.quotepath is on. fetchChangedFiles then split those quoted lines, so yarn workspaces list --since attributed the change to the root workspace instead of the real one.

Pass -z and split on NUL so each path stays one entry.

Fixes #6804

What's the problem this PR addresses?

When a changed file has special characters in the name (for example "), git diff --name-only wraps the path in C-quotes. fetchChangedFiles split on newlines and treated that quoted string as the path, so tryWorkspaceByFilePath missed the workspace and yarn workspaces list --since reported the root instead.

Closes #6804

How did you fix it?

Use git diff -z --name-only and git ls-files -z --others --exclude-standard, then split the stdout on NUL. Same listing, no quoting.

Testing

  • yarn test:unit packages/plugin-git/tests/gitUtils.test.ts — 91 passed, including a temp-repo regression that stages and leaves untracked files whose names git would C-quote.
  • Added --since keeps workspaces whose changed files have special characters in the name next to the existing --since list tests.

Checklist

  • I have read the Contributing Guide.
  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@r3wretrhy
r3wretrhy force-pushed the fix-git-name-only-quoting branch from 18a02fa to c6f1c49 Compare September 16, 2026 20:53
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.

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

1 participant