Skip to content

Commit dffdfa6

Browse files
authored
fix(core): disable ignore filters for outputs expansion (#34316)
## Current Behavior When a task output directory contains a nested `.gitignore` that hides its contents, Nx can treat the outputs as already present and skip restoring them from cache. This can result in generated files being missing from disk, even though the cache entry is valid. ## Expected Behavior Nx should restore cached outputs regardless of ignore rules inside the output directory. ## Related Issue(s) Fixes #32620
1 parent a40ff52 commit dffdfa6

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

packages/nx/src/native/cache/expand_outputs.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,20 @@ mod test {
312312
);
313313
}
314314

315+
#[test]
316+
fn should_get_files_for_outputs_when_gitignore_hides_files() {
317+
let temp = TempDir::new().unwrap();
318+
temp.child("out/.gitignore").write_str("*").unwrap();
319+
temp.child("out/visible.txt").write_str("content").unwrap();
320+
321+
let entries = vec!["out".to_string()];
322+
let mut result = get_files_for_outputs(temp.display().to_string(), entries).unwrap();
323+
result.sort();
324+
325+
assert!(result.contains(&"out/visible.txt".to_string()));
326+
assert!(result.contains(&"out/.gitignore".to_string()));
327+
}
328+
315329
#[test]
316330
#[ignore]
317331
#[cfg(any(target_os = "linux", target_os = "macos"))]

packages/nx/src/native/walker.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ where
191191
}
192192

193193
walker.add_custom_ignore_filename(".nxignore");
194+
} else {
195+
// Don't filter out ignored files
196+
walker.standard_filters(false);
194197
}
195198

196199
// We should make sure to always ignore node_modules and the .git folder

0 commit comments

Comments
 (0)