dx(skills): fix grep -c || echo 0 producing invalid integer

grep -c outputs 0 to stdout and exits non-zero when no matches found,
so || echo 0 would append a second 0 making a multi-line string.
Use || true instead to suppress the non-zero exit without extra output.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Nicholas Tindle
2026-03-27 04:31:39 -05:00
parent a95cfc3cae
commit 80dbeb1596

View File

@@ -29,7 +29,7 @@ Detect if the repo is already inside a worktree layout by counting sibling workt
```bash
# Count worktrees that are siblings (live under $PARENT but aren't $ROOT itself)
SIBLING_COUNT=$(git worktree list --porcelain 2>/dev/null | grep "^worktree " | grep -c "$PARENT/" || echo 0)
SIBLING_COUNT=$(git worktree list --porcelain 2>/dev/null | grep "^worktree " | grep -c "$PARENT/" || true)
if [ "$SIBLING_COUNT" -gt 1 ]; then
echo "INFO: Existing worktree layout detected at $PARENT ($SIBLING_COUNT worktrees)"
# Use $ROOT as-is; skip renaming/restructuring