Skip to content

Conversation

@tt-a1i
Copy link
Contributor

@tt-a1i tt-a1i commented Dec 14, 2025

Summary

Fix --changed and --staged flags throwing "No such file or directory" error when a file has been deleted or renamed in the working directory but the change hasn't been committed yet.

The issue occurs because:

  1. git diff --name-only base...HEAD returns files that exist in HEAD
  2. If a file is deleted/renamed in the working directory (uncommitted), it no longer exists on disk
  3. The CLI tries to read the non-existent file and throws an error

Solution

Filter out files that no longer exist in the working directory before processing them. This is done in get_changed_files and get_staged_files functions using fs.path_exists().

Test plan

Manual testing:

  1. git checkout main
  2. echo "const a=1" > test.ts
  3. git add test.ts && git commit -m "add test.ts"
  4. git checkout -b test
  5. echo "const a=2" > test.ts
  6. git add test.ts && git commit -m "modify test.ts"
  7. mv test.ts test2.ts
  8. biome check --changed - should no longer throw error

Closes #4952

@changeset-bot
Copy link

changeset-bot bot commented Dec 14, 2025

🦋 Changeset detected

Latest commit: 207af04

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 14, 2025

Warning

Rate limit exceeded

@tt-a1i has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 14 minutes and 32 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between a392c06 and 207af04.

⛔ Files ignored due to path filters (2)
  • crates/biome_cli/tests/snapshots/main_commands_lint/should_skip_nonexistent_changed_files.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_commands_lint/should_skip_nonexistent_staged_files.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (3)
  • .changeset/fix-changed-deleted-file.md (1 hunks)
  • crates/biome_cli/src/changed.rs (2 hunks)
  • crates/biome_cli/tests/commands/lint.rs (1 hunks)
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added the A-CLI Area: CLI label Dec 14, 2025
@tt-a1i tt-a1i force-pushed the fix/changed-deleted-file branch from f9ee441 to 207af04 Compare December 14, 2025 03:26
@dyc3 dyc3 merged commit c3df0e0 into biomejs:main Dec 14, 2025
13 checks passed
This was referenced Dec 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CLI Area: CLI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 --changed throws No such file or directory when file is deleted

2 participants