Skip to main content

current_branch

Function current_branch 

Source
pub fn current_branch() -> Option<&'static str>
Expand description

The branch HEAD names, or None on a detached head — asked of git ONCE per process and lent to every check that wants it.

Two always-on pre-commit checks (branch-pattern, branch-protect) open with this same question. Asked twice it is two spawns on every commit, which is exactly the o(checks) growth tests/spawn_budget.rs exists to refuse; asked once it is the price of one check, however many share it.