(
root: &Path,
dir: &Path,
worktree_rules: &crate::ignore::IgnoreRules,
workspace_rules: &crate::ignore::IgnoreRules,
out: &mut Vec<String>,
| 1646 | let workspace_rules = IgnoreRules::load(root); |
| 1647 | let mut result = Vec::new(); |
| 1648 | fn walk( |
| 1649 | root: &Path, |
| 1650 | dir: &Path, |
| 1651 | worktree_rules: &crate::ignore::IgnoreRules, |
| 1652 | workspace_rules: &crate::ignore::IgnoreRules, |
| 1653 | out: &mut Vec<String>, |
| 1654 | ) { |
| 1655 | let Ok(entries) = std::fs::read_dir(dir) else { |
| 1656 | return; |
| 1657 | }; |
| 1658 | for entry in entries.flatten() { |
| 1659 | let path = entry.path(); |
| 1660 | let Ok(relative) = path.strip_prefix(root) else { |
| 1661 | continue; |
| 1662 | }; |
| 1663 | let is_directory = path.is_dir(); |
| 1664 | let ignored = worktree_rules.is_ignored(relative, is_directory) |
| 1665 | || workspace_rules.is_ignored(relative, is_directory); |
| 1666 | if ignored { |
| 1667 | if let Some(relative) = relative.to_str() { |
| 1668 | out.push(relative.to_string()); |
| 1669 | } |
| 1670 | } else if is_directory { |
| 1671 | walk(root, &path, worktree_rules, workspace_rules, out); |
| 1672 | } |
| 1673 | } |
| 1674 | } |
| 1675 | walk(root, root, &worktree_rules, &workspace_rules, &mut result); |
| 1676 | result.sort(); |
| 1677 | result |
no test coverage detected