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

Function current_branch_git

src/branch.rs:81–94  ·  view source on GitHub ↗
(project_root: &Path)

Source from the content-addressed store, hash-verified

79}
80
81fn 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
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())

Callers 1

current_branchFunction · 0.85

Calls 3

outputMethod · 0.80
successMethod · 0.80
git_programFunction · 0.70

Tested by

no test coverage detected