Files
beads/.gitignore
David Laing 8c2679a80e Fix substring bug in dependency tree cycle detection (#159)
* Add .worktrees/ to .gitignore

Prevents git worktree contents from being tracked in the repository.

* Fix substring bug in dependency tree cycle detection

The cycle detection in GetDependencyTree() was using a simple substring
match which incorrectly flagged valid nodes as cycles. For example,
"bd-1" would be blocked because "bd-10" contains "bd-1" as a substring.

This bug affects any beads project where issue IDs contain each other as
substrings (BD-1/BD-10, ISSUE-1/ISSUE-10, etc).

Changed from:
  AND t.path NOT LIKE '%' || i.id || '%'

To delimiter-aware checks that respect the → separator:
  AND t.path != i.id
  AND t.path NOT LIKE i.id || '→%'
  AND t.path NOT LIKE '%→' || i.id || '→%'
  AND t.path NOT LIKE '%→' || i.id

This ensures we only match complete issue IDs, not substrings.

Added TestGetDependencyTree_SubstringBug to demonstrate and prevent
regression of this issue. The test creates a chain from bd-10 to bd-1
and verifies all nodes appear in the dependency tree.

Discovered while testing dependency tree visualization with bd-1/bd-10.
2025-10-27 12:51:41 -07:00

59 lines
672 B
Plaintext

# Binaries
/beads
/bd
*.exe
*.dll
*.so
*.dylib
# Test binaries
*.test
*.out
# Go workspace file
go.work
# IDE
.vscode/
.idea/
*.swp
*.swo
*~
# Claude Code
.claude/settings.local.json
# OS
.DS_Store
Thumbs.db
# SQLite databases (now using JSONL as source of truth)
*.db
*.db-journal
*.db-wal
*.db-shm
# Daemon runtime files
.beads/daemon.log
.beads/daemon.pid
.beads/daemon.lock
.beads/bd.sock
.beads/.exclusive-lock
# .beads directory files (keep JSONL only)
.beads/.gitignore
.beads/db.sqlite
.beads/bd.db
# Keep JSONL exports (source of truth for git)
!.beads/*.jsonl
# Ignore nix result
result
# GoReleaser build artifacts
dist/
# Git worktrees
.worktrees/