grep -cv (and grep -v) return exit code 1 when there are zero matches. With set -euo pipefail this silently aborted the script before count was returned — causing 'agent.sh new' to fail on a fresh repo with no existing worktrees. Fix: move the grep -v into worktree_paths with '|| true' so the function always exits 0, then derive worktree_count via wc -l. |
||
|---|---|---|
| .. | ||
| agent.sh | ||