(dir: &Path, work_tree: Option<&Path>, args: &[&str])
| 437 | } |
| 438 | |
| 439 | fn run_git(dir: &Path, work_tree: Option<&Path>, args: &[&str]) -> Result<Output> { |
| 440 | let mut cmd = Command::new("git"); |
| 441 | cmd.arg(format!("--git-dir={}", dir.display())); |
| 442 | |
| 443 | if let Some(work_tree_path) = work_tree { |
| 444 | cmd.arg(format!("--work-tree={}", work_tree_path.display())); |
| 445 | } |
| 446 | |
| 447 | cmd.args(args); |
| 448 | |
| 449 | debug!("Executing git command: {:?}", cmd); |
| 450 | let output = cmd.output()?; |
| 451 | |
| 452 | if !output.status.success() { |
| 453 | debug!("Git command failed with exit code: {:?}", output.status.code()); |
| 454 | debug!("Git stderr: {}", String::from_utf8_lossy(&output.stderr)); |
| 455 | debug!("Git stdout: {}", String::from_utf8_lossy(&output.stdout)); |
| 456 | |
| 457 | if !output.stderr.is_empty() { |
| 458 | bail!( |
| 459 | "Checkpoint operation failed: {}", |
| 460 | String::from_utf8_lossy(&output.stderr) |
| 461 | ); |
| 462 | } else { |
| 463 | bail!("Checkpoint operation failed unexpectedly"); |
| 464 | } |
| 465 | } |
| 466 | |
| 467 | debug!("Git command succeeded"); |
| 468 | Ok(output) |
| 469 | } |
| 470 | |
| 471 | fn get_previous_tag(tag: &str) -> String { |
| 472 | // Parse turn.tool format |
no test coverage detected