MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / walk

Method walk

atomic-repository/src/repository/switch.rs:1648–1674  ·  view source on GitHub ↗
(
            root: &Path,
            dir: &Path,
            worktree_rules: &crate::ignore::IgnoreRules,
            workspace_rules: &crate::ignore::IgnoreRules,
            out: &mut Vec<String>,

Source from the content-addressed store, hash-verified

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

Callers 15

source_fingerprintFunction · 0.45
inspectFunction · 0.45
parametersFunction · 0.45
namesFunction · 0.45
childrenFunction · 0.45
namedFunction · 0.45
childrenFunction · 0.45
tokensFunction · 0.45
from_treeMethod · 0.45
walk_treeMethod · 0.45
extract_functionMethod · 0.45

Calls 5

is_dirMethod · 0.80
walkFunction · 0.70
pathMethod · 0.45
is_ignoredMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected