Check if a path is inside a git repository.
(path: &Path)
| 29 | |
| 30 | /// Check if a path is inside a git repository. |
| 31 | pub 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. |
| 41 | pub fn ensure_git_installed() -> Result<()> { |