Run a git command.
(repo_path: &Path, args: &[&str])
| 392 | |
| 393 | /// Run a git command. |
| 394 | fn run_git(repo_path: &Path, args: &[&str]) -> Result<(bool, String, String)> { |
| 395 | ensure_git_installed()?; |
| 396 | |
| 397 | let output = Command::new("git") |
| 398 | .args(["-C", &repo_path.display().to_string()]) |
| 399 | .args(args) |
| 400 | .output() |
| 401 | .map_err(|e| anyhow!("Failed to execute git: {}", e))?; |
| 402 | |
| 403 | let stdout = String::from_utf8_lossy(&output.stdout).to_string(); |
| 404 | let stderr = String::from_utf8_lossy(&output.stderr).to_string(); |
| 405 | |
| 406 | Ok((output.status.success(), stdout, stderr)) |
| 407 | } |
| 408 | |
| 409 | // ==================== Git Operations ==================== |
| 410 |
no test coverage detected