MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / glob_up

Function glob_up

crates/opencode-session/src/instruction.rs:143–158  ·  view source on GitHub ↗

Walk up from `start` to `stop`, expanding a glob pattern at each level.

(pattern: &str, start: &Path, stop: &Path)

Source from the content-addressed store, hash-verified

141
142/// Walk up from `start` to `stop`, expanding a glob pattern at each level.
143fn glob_up(pattern: &str, start: &Path, stop: &Path) -> Vec<PathBuf> {
144 let mut current = normalize(start);
145 let stop = normalize(stop);
146 let mut result = Vec::new();
147 loop {
148 result.extend(expand_glob(pattern, &current));
149 if current == stop {
150 break;
151 }
152 match current.parent() {
153 Some(p) if p != current => current = p.to_path_buf(),
154 _ => break,
155 }
156 }
157 result
158}
159
160fn is_glob_pattern(s: &str) -> bool {
161 s.contains('*') || s.contains('?')

Callers 1

resolve_config_pathMethod · 0.85

Calls 3

normalizeFunction · 0.85
newFunction · 0.85
expand_globFunction · 0.85

Tested by

no test coverage detected