pub fn detect_branch(path: &Path) -> StringExpand description
Detect the current git branch for the given path.
Uses get_current_branch which resolves worktree .git files correctly,
handles detached HEAD (returns short commit hash), and normalizes path
components. Falls back to "main" on any error with a debug trace.