pub fn phase_commit_count(
project_root: &Path,
git_flow: &GitFlowConfig,
phase: u32,
) -> u32Expand description
Commits on the phase’s feature branch that are not on develop.
Derives the branch name from git_flow.feature_prefix and the zero-padded
phase, verifies the branch exists with rev-parse --verify, and on
success counts {git_flow.develop}..{branch} with rev-list --count.
This is the single implementation of that count — evaluate_layer2 and
pipeline_outcomes::handle_validate_outcome’s forward-progress check both
call it rather than each re-deriving the branch name and re-running the
same two git commands, which is what made the two counts able to silently
diverge before this extraction.
Must be called with the main project_root, never a worktree path — git
worktrees share refs and the object database, so a commit made inside a
linked worktree is immediately visible to a count run from the main
checkout, which is the property every caller already relies on.
A 0 return is deliberately indistinguishable across three causes:
genuinely no commits, the branch does not exist, or git could not be
run. Every consumer treats all three the same way.