Skip to content

Commit 0e21606

Browse files
committed
fix: surface nested-glob walk errors
Make nested-glob traversal and clean report skipped WalkDir errors in verbose/debug output so filesystem issues are visible during review. Clarify that exclude patterns match directories too, which enables subtree pruning without requiring a trailing /**.
1 parent 273b3f3 commit 0e21606

2 files changed

Lines changed: 37 additions & 5 deletions

File tree

src/config.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,11 @@ pub struct TargetConfig {
113113
pub pattern: Option<String>,
114114

115115
/// Glob patterns that exclude paths from a `nested-glob` search.
116-
/// Each pattern is matched against the path of a discovered file relative
117-
/// to the search root. Common defaults include `node_modules/**` and
118-
/// `**/.git/**`. Has no effect on other target types.
116+
/// Each pattern is matched against discovered paths relative to the search
117+
/// root, including both files and directories. Directory matches are used
118+
/// to prune whole subtrees during traversal, so `node_modules`,
119+
/// `node_modules/**`, `.git`, and `**/.git/**` all prevent descending into
120+
/// those directories. Has no effect on other target types.
119121
#[serde(default)]
120122
pub exclude: Vec<String>,
121123

src/linker.rs

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,22 @@ impl Linker {
611611
while let Some(entry) = it.next() {
612612
let entry = match entry {
613613
Ok(e) => e,
614-
Err(_) => continue,
614+
Err(err) => {
615+
if options.verbose {
616+
let path = err
617+
.path()
618+
.map(|p| p.display().to_string())
619+
.unwrap_or_else(|| "<unknown path>".to_string());
620+
println!(
621+
" {} WalkDir error while scanning {}: {}",
622+
"!".yellow(),
623+
path,
624+
err
625+
);
626+
}
627+
tracing::debug!(error = %err, path = ?err.path(), "WalkDir entry skipped during nested-glob sync");
628+
continue;
629+
}
615630
};
616631

617632
// Compute path relative to search root
@@ -830,7 +845,22 @@ impl Linker {
830845
while let Some(entry) = it.next() {
831846
let entry = match entry {
832847
Ok(e) => e,
833-
Err(_) => continue,
848+
Err(err) => {
849+
if options.verbose {
850+
let path = err
851+
.path()
852+
.map(|p| p.display().to_string())
853+
.unwrap_or_else(|| "<unknown path>".to_string());
854+
println!(
855+
" {} WalkDir error while cleaning {}: {}",
856+
"!".yellow(),
857+
path,
858+
err
859+
);
860+
}
861+
tracing::debug!(error = %err, path = ?err.path(), "WalkDir entry skipped during nested-glob clean");
862+
continue;
863+
}
834864
};
835865

836866
let rel_path = match entry.path().strip_prefix(&search_root) {

0 commit comments

Comments
 (0)