Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ function run(cmd, cwd) {

// ---- ensure-worktree — 确保变更的隔离 worktree 已创建 ----
function runEnsureWorktree(name, cwd) {
if (!/^[a-zA-Z0-9_-]+$/.test(name)) {
console.error(t(' ✗ 无效的变更名(仅允许字母、数字、- 和 _)', ' ✗ Invalid name (only alphanumeric, - and _ are allowed)'));
process.exit(1);
}
const worktreeDir = path.join(cwd, '.worktrees', name);

if (fs.existsSync(worktreeDir)) {
Expand Down