MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / git_rev_list_count

Function git_rev_list_count

src/branch.rs:96–110  ·  view source on GitHub ↗
(project_root: &Path, from_ref: &str, to_ref: &str)

Source from the content-addressed store, hash-verified

94}
95
96fn 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

Callers 1

Calls 4

outputMethod · 0.80
successMethod · 0.80
git_programFunction · 0.70
parseMethod · 0.45

Tested by

no test coverage detected