(args: &[&str], cwd: &Path)
| 185 | } |
| 186 | |
| 187 | pub fn run(args: &[&str], cwd: &Path) -> GitResult { |
| 188 | let output = Command::new("git").args(args).current_dir(cwd).output(); |
| 189 | |
| 190 | match output { |
| 191 | Ok(output) => GitResult { |
| 192 | exit_code: output.status.code().unwrap_or(1), |
| 193 | stdout: String::from_utf8_lossy(&output.stdout).to_string(), |
| 194 | stderr: String::from_utf8_lossy(&output.stderr).to_string(), |
| 195 | }, |
| 196 | Err(e) => GitResult { |
| 197 | exit_code: 1, |
| 198 | stdout: String::new(), |
| 199 | stderr: e.to_string(), |
| 200 | }, |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | pub fn is_repo(path: &Path) -> bool { |
| 205 | path.join(".git").exists() |
no test coverage detected