should_create_new_branch

Function should_create_new_branch 

Source
pub(crate) fn should_create_new_branch(branch_name: &str) -> Result<bool>
Expand description

Returns true if a new branch may be created following the desired behavior.

Behaviour:

  • Always allowed when target is a default branch (main/master).
  • Always allowed when current branch is a default branch.
  • Otherwise, requires user confirmation via empty line input (non‑empty aborts).

§Errors

  • Current branch discovery via [ytil_git::branch::get_current] fails.
  • Reading user confirmation input fails.