Skip to main content

sanitize_branch_name

Function sanitize_branch_name 

Source
pub fn sanitize_branch_name(branch_name: &str) -> String
Expand description

Convert branch name to safe directory name.

Handles branch names with slashes (feat/auth), special characters, and other filesystem-unsafe characters.

ยงExamples

use git_worktree_manager::constants::sanitize_branch_name;
assert_eq!(sanitize_branch_name("feat/auth"), "feat-auth");
assert_eq!(sanitize_branch_name("feature/user@login"), "feature-user-login");
assert_eq!(sanitize_branch_name("hotfix/v2.0"), "hotfix-v2.0");