MCPcopy Create free account
hub / github.com/aws/amazon-q-developer-cli / run_git

Function run_git

crates/chat-cli/src/cli/chat/checkpoint.rs:439–469  ·  view source on GitHub ↗
(dir: &Path, work_tree: Option<&Path>, args: &[&str])

Source from the content-addressed store, hash-verified

437}
438
439fn 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
471fn get_previous_tag(tag: &str) -> String {
472 // Parse turn.tool format

Callers 8

manual_initMethod · 0.85
restoreMethod · 0.85
tag_has_any_pathsMethod · 0.85
compute_stats_betweenMethod · 0.85
diffMethod · 0.85
has_changesMethod · 0.85
configure_gitFunction · 0.85
stage_commit_tagFunction · 0.85

Calls 3

outputMethod · 0.80
successMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected