(project_root: &Path)
| 79 | } |
| 80 | |
| 81 | fn current_branch_git(project_root: &Path) -> Option<String> { |
| 82 | let output = std::process::Command::new(crate::git::git_program()) |
| 83 | .args(["symbolic-ref", "-q", "HEAD"]) |
| 84 | .current_dir(project_root) |
| 85 | .output() |
| 86 | .ok()?; |
| 87 | if !output.status.success() { |
| 88 | return None; |
| 89 | } |
| 90 | let name = std::str::from_utf8(&output.stdout).ok()?; |
| 91 | name.strip_prefix("refs/heads/") |
| 92 | .and_then(|s| s.strip_suffix('\n')) |
| 93 | .map(std::string::ToString::to_string) |
| 94 | } |
| 95 | |
| 96 | fn git_rev_list_count(project_root: &Path, from_ref: &str, to_ref: &str) -> Option<usize> { |
| 97 | let output = std::process::Command::new(crate::git::git_program()) |
no test coverage detected