(project_root: &Path, from_ref: &str, to_ref: &str)
| 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()) |
| 98 | .args(["rev-list", "--count", &format!("{from_ref}..{to_ref}")]) |
| 99 | .current_dir(project_root) |
| 100 | .output() |
| 101 | .ok()?; |
| 102 | if !output.status.success() { |
| 103 | return None; |
| 104 | } |
| 105 | std::str::from_utf8(&output.stdout) |
| 106 | .ok()? |
| 107 | .trim() |
| 108 | .parse() |
| 109 | .ok() |
| 110 | } |
| 111 | |
| 112 | /// In-process equivalent of `git rev-list --count hidden..tip`: commits |
| 113 | /// reachable from `tip` but not from `hidden`. Saves a `git` subprocess |
no test coverage detected