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

Function detect_worktree_stop

crates/opencode-config/src/loader.rs:489–505  ·  view source on GitHub ↗
(start: &Path)

Source from the content-addressed store, hash-verified

487}
488
489fn detect_worktree_stop(start: &Path) -> PathBuf {
490 let mut current = normalize_existing_path(start);
491 let mut topmost = current.clone();
492 loop {
493 if current.join(".git").exists() {
494 return current;
495 }
496 let Some(parent) = current.parent() else {
497 return topmost;
498 };
499 if parent == current {
500 return topmost;
501 }
502 topmost = parent.to_path_buf();
503 current = parent.to_path_buf();
504 }
505}
506
507fn find_up(target: &str, start: &Path, stop: &Path) -> Vec<PathBuf> {
508 let mut current = normalize_existing_path(start);

Callers 2

load_projectMethod · 0.85

Calls 3

normalize_existing_pathFunction · 0.85
existsMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected