MCPcopy Create free account
hub / github.com/ForgeAILab/forge / run_git

Function run_git

crates/git/src/lib.rs:32–51  ·  view source on GitHub ↗
(cwd: &Path, args: &[&str])

Source from the content-addressed store, hash-verified

30}
31
32async fn run_git(cwd: &Path, args: &[&str]) -> Result<String> {
33 let output = Command::new("git")
34 .args(args)
35 .current_dir(cwd)
36 .env_remove("GIT_DIR")
37 .env_remove("GIT_WORK_TREE")
38 .env_remove("GIT_INDEX_FILE")
39 .output()
40 .await?;
41
42 if !output.status.success() {
43 return Err(GitError::CommandFailed {
44 command: format!("git {}", args.join(" ")),
45 stdout: String::from_utf8_lossy(&output.stdout).to_string(),
46 stderr: String::from_utf8_lossy(&output.stderr).to_string(),
47 });
48 }
49
50 Ok(String::from_utf8_lossy(&output.stdout).trim().to_string())
51}
52
53pub async fn is_git_repo(path: &Path) -> bool {
54 tokio::fs::symlink_metadata(path.join(".git")).await.is_ok()

Callers 15

list_branchesFunction · 0.70
create_worktreeFunction · 0.70
remove_worktreeFunction · 0.70
get_current_shaFunction · 0.70
is_worktree_cleanFunction · 0.70
status_porcelainFunction · 0.70
branch_existsFunction · 0.70
checkout_branchFunction · 0.70
mergeFunction · 0.70
abort_mergeFunction · 0.70
get_diffFunction · 0.70
stage_allFunction · 0.70

Calls

no outgoing calls

Tested by 2

test_rebase_cleanFunction · 0.56