()
| 71 | // --- git test harness (mirrors src/mcp/hook_events.rs tests) ------------ |
| 72 | |
| 73 | fn git_program() -> std::ffi::OsString { |
| 74 | use std::sync::OnceLock; |
| 75 | static GIT: OnceLock<std::ffi::OsString> = OnceLock::new(); |
| 76 | GIT.get_or_init(|| { |
| 77 | if let Some(explicit) = std::env::var_os("GIT") { |
| 78 | return explicit; |
| 79 | } |
| 80 | let exe_name = if cfg!(windows) { "git.exe" } else { "git" }; |
| 81 | if let Some(paths) = std::env::var_os("PATH") { |
| 82 | for dir in std::env::split_paths(&paths) { |
| 83 | let candidate = dir.join(exe_name); |
| 84 | if candidate.is_file() { |
| 85 | return candidate.into_os_string(); |
| 86 | } |
| 87 | } |
| 88 | } |
| 89 | std::ffi::OsString::from("git") |
| 90 | }) |
| 91 | .clone() |
| 92 | } |
| 93 | |
| 94 | fn run_git(cwd: &Path, args: &[&str]) { |
| 95 | assert!(cwd.is_dir(), "git cwd {cwd:?} should exist"); |
no outgoing calls
no test coverage detected