Simplify netty worktree commands

Collapse the netty worktree helpers into wt create/remove/prune, keep wt-create as a thin wrapper, and drop the standalone wt-path command.

Also make the netty zsh wrappers handle cd-only behavior for wtc and wt remove.

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Harivansh Rathi 2026-03-30 18:36:50 +00:00
parent 29359546aa
commit bc47e44ddb
5 changed files with 218 additions and 64 deletions

View file

@ -2,28 +2,4 @@
set -euo pipefail
if [[ $# -ne 1 ]]; then
printf 'usage: wt-create <worktree-name>\n' >&2
exit 1
fi
branch_name=$1
repo_root=$(git rev-parse --show-toplevel 2>/dev/null) || {
printf 'wt-create: not inside a git repository\n' >&2
exit 1
}
target_path=$(wt-path "$branch_name")
if [[ -e "$target_path" ]]; then
printf 'wt-create: path already exists: %s\n' "$target_path" >&2
exit 1
fi
if git -C "$repo_root" show-ref --verify --quiet "refs/heads/$branch_name"; then
git -C "$repo_root" worktree add -- "$target_path" "$branch_name" 1>&2
else
git -C "$repo_root" worktree add -b "$branch_name" -- "$target_path" HEAD 1>&2
fi
printf '%s\n' "$target_path"
exec wt create "$@"