rebase ignore crate from 0.4.24 to 0.4.33 - #20409
Conversation
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (2): Last reviewed commit: "rebase `ignore` crate from 0.4.24 to 0.4..." | Re-trigger Greptile |
WalkthroughThe 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (2)
crates/ignore/src/walk.rs (1)
328-335: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDuplicate
WithDepthwrapper in twoDirEntryRawconstructors. Both sites call.with_depth(depth)and then wrap the result in a secondError::WithDepthwith the same depth, producingWithDepth { WithPath { WithDepth { Io } } }. No public accessor changes behavior, becauseError::depthreads the outermostWithDepthandDisplayforWithDepthdelegates to the inner error. The extra layer is still redundant, and it is inconsistent withfrom_pathat Line 395, which wraps once.
crates/ignore/src/walk.rs#L328-L335: infrom_entry, drop theError::WithDepth { depth, err: Box::new(err) }line and returnError::Io(err).with_depth(depth).with_path(ent.path())directly.crates/ignore/src/walk.rs#L345-L348: in the Windowsfrom_entry_os, apply the same change so the metadata error is wrapped once.crates/ignore/src/pathutil.rs (1)
19-39: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRename the parameter and document the Windows stat cost.
Two small points on
is_hidden_path:
- The parameter is named
dentbut its type is&Path. The name is a copy of theis_hidden_entrysignature. The innerimpalready usespath.- On Windows this function calls
path.metadata(), which is a real syscall.is_hidden_entrydocuments that its metadata is already cached by the traverser and is therefore "free".is_hidden_pathhas no such note, andincremental.rscalls it per intermediate directory at Line 379 and per matched path at Line 407.Both call sites guard on
mat.is_none(), and theIncrementalIgnoredocs already warn about extra per-path work, so no behavior change is needed. Add a note so future readers do not assume the two functions cost the same.♻️ Proposed fix
/// ## All other platforms /// /// This only returns true if the base name of the path starts with a `.`. -pub(crate) fn is_hidden_path(dent: &Path) -> bool { +/// +/// Note that on Windows this performs a `stat` call to read the file +/// attributes. Prefer [`is_hidden_entry`] when a directory entry is +/// available, since its metadata is already cached by the traverser. +pub(crate) fn is_hidden_path(path: &Path) -> bool { #[cfg(not(windows))] fn imp(path: &Path) -> bool { is_hidden_path_only(path) } #[cfg(windows)] fn imp(path: &Path) -> bool { use std::os::windows::fs::MetadataExt; use winapi_util::file; if let Ok(md) = path.metadata() { if file::is_hidden(md.file_attributes() as u64) { return true; } } is_hidden_path_only(path) } - imp(dent) + imp(path) }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: de182fdf-0d87-4efa-b4f9-56d8ca0ca638
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (12)
crates/ignore/Cargo.tomlcrates/ignore/examples/walk.rscrates/ignore/src/default_types.rscrates/ignore/src/dir.rscrates/ignore/src/gitignore.rscrates/ignore/src/incremental.rscrates/ignore/src/lib.rscrates/ignore/src/overrides.rscrates/ignore/src/pathutil.rscrates/ignore/src/types.rscrates/ignore/src/walk.rscrates/ignore/tests/gitignore_matched_path_or_any_parents_tests.rs
cde1db8 to
a4d3f80
Compare
This PR updates the vendored
ignore/crate to make use of the upstream improvements.We can't fully use the native
ignorecrate yet because of the missing functionality that we added ourselves. Our own changes are still marked asCHANGED:Test plan
Stack created with GitHub Stacks CLI • Give Feedback 💬