Skip to content

fix(oxfmt): Always respect ignored files even specified#16632

Merged
graphite-app[bot] merged 1 commit intomainfrom
12-09-fix_oxfmt_always_respect_ignored_files_even_specified
Dec 9, 2025
Merged

fix(oxfmt): Always respect ignored files even specified#16632
graphite-app[bot] merged 1 commit intomainfrom
12-09-fix_oxfmt_always_respect_ignored_files_even_specified

Conversation

@leaysgur
Copy link
Copy Markdown
Member

@leaysgur leaysgur commented Dec 9, 2025

Fixes #16621

Copilot AI review requested due to automatic review settings December 9, 2025 07:22
@github-actions github-actions bot added A-cli Area - CLI A-formatter Area - Formatter C-bug Category - Bug labels Dec 9, 2025
Copy link
Copy Markdown
Member Author

leaysgur commented Dec 9, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes oxfmt to always respect ignored files, even when explicitly specified on the command line. The key change is refactoring Walk::build() to pre-filter target paths against ignore rules before passing them to the walker, ensuring that explicitly specified files are still ignored if they match ignore patterns.

  • Refactored path normalization logic into Walk::build() for better code locality
  • Added pre-filtering of target paths using GitignoreBuilder to respect ignore rules
  • Changed Walk::build() return type to Result<Option<Self>, String> to distinguish between errors and valid no-files-found states
  • Added comprehensive test coverage for various ignore scenarios including explicit file specification and the --no-error-on-unmatched-pattern flag

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
apps/oxfmt/src/cli/walk.rs Core logic changes: inlined path normalization, added pre-filtering of target paths against ignore rules, removed OverrideBuilder in favor of unified GitignoreBuilder approach, improved code style with .into_iter() and .then_some()
apps/oxfmt/src/cli/format.rs Updated to handle new Result<Option<Walk>, String> return type with appropriate error messages for the Ok(None) case
apps/oxfmt/test/ignore_and_override.test.ts Added test cases for explicitly specified files being ignored and --no-error-on-unmatched-pattern flag behavior
apps/oxfmt/test/snapshots/ignore_and_override.test.ts.snap Updated snapshots to reflect new behavior where ignored files are always respected

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@leaysgur leaysgur added the 0-merge Merge with Graphite Merge Queue label Dec 9, 2025
Copy link
Copy Markdown
Member Author

leaysgur commented Dec 9, 2025

Merge activity

@graphite-app graphite-app bot force-pushed the 12-09-fix_oxfmt_always_respect_ignored_files_even_specified branch from b13c044 to 02f59ba Compare December 9, 2025 08:01
@graphite-app graphite-app bot merged commit 02f59ba into main Dec 9, 2025
18 checks passed
@graphite-app graphite-app bot deleted the 12-09-fix_oxfmt_always_respect_ignored_files_even_specified branch December 9, 2025 08:07
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-formatter Area - Formatter C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

oxfmt: ignorePatterns are not applied when passing a file path directly.

4 participants