class ChefCLI::CookbookProfiler::Git

def unborn_branch_ref

def unborn_branch_ref
  @unborn_branch_ref ||=
    begin
      strict_branch_ref = git!("symbolic-ref -q HEAD").stdout.strip
      verify_ref_cmd = git("show-ref --verify #{strict_branch_ref}")
      if verify_ref_cmd.error?
        @unborn_branch = true
        strict_branch_ref
      else
        # if we got here, but verify_ref_cmd didn't error, then `git
        # rev-parse` is probably failing for a reason we haven't anticipated.
        # Calling code should detect this and re-raise.
        nil
      end
    end
end