MCPcopy Index your code
hub / github.com/AI45Lab/Code / is_git_repo

Function is_git_repo

core/src/git.rs:31–38  ·  view source on GitHub ↗

Check if a path is inside a git repository.

(path: &Path)

Source from the content-addressed store, hash-verified

29
30/// Check if a path is inside a git repository.
31pub fn is_git_repo(path: &Path) -> bool {
32 Command::new("git")
33 .args(["-C", &path.display().to_string()])
34 .args(["rev-parse", "--git-dir"])
35 .output()
36 .map(|o| o.status.success())
37 .unwrap_or(false)
38}
39
40/// Ensure git is installed. Downloads and installs git if not found.
41pub fn ensure_git_installed() -> Result<()> {

Callers 1

is_repositoryMethod · 0.85

Calls 1

successMethod · 0.45

Tested by

no test coverage detected