v4 refactors check_refname_component() so that we could do more accurate substitution (and leave fewer traps). Performance of sanitize_worktree_refname() goes back to horrible again. But since it's not really a big deal (no body is going to add 200 worktrees per second), I don't feel like we should optimize it. That may involve removing the for loop in do_check_refname_component() and making things uglier. The test is also updated to have FUNNYNAMES prerequisite, which is always unset on Windows. This should fix the breakage there. Nguyễn Thái Ngọc Duy (2): refs.c: refactor check_refname_component() worktree add: sanitize worktree names builtin/worktree.c | 7 ++- refs.c | 114 ++++++++++++++++++++++++++++++++++------ refs.h | 1 + t/t2025-worktree-add.sh | 5 ++ 4 files changed, 110 insertions(+), 17 deletions(-) -- 2.21.0.rc1.337.gdf7f8d0522