Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion internal/discover/discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var IGNORE_PATTERNS = map[string]bool{
".npm": true, ".nyc_output": true, ".pnpm-store": true,
".pytest_cache": true, ".qdrant_code_embeddings": true,
".ruff_cache": true, ".svn": true, ".tmp": true, ".tox": true,
".venv": true, ".vs": true, ".vscode": true, ".yarn": true,
".venv": true, ".vs": true, ".vscode": true, ".worktrees": true, ".yarn": true,
"__pycache__": true, "bin": true, "bower_components": true,
"build": true, "coverage": true, "dist": true, "env": true,
"htmlcov": true, "node_modules": true, "obj": true, "out": true,
Expand Down
31 changes: 31 additions & 0 deletions internal/discover/discover_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,37 @@ func TestDisambiguateM(t *testing.T) {
}
}

func TestDiscoverSkipsWorktrees(t *testing.T) {
dir := t.TempDir()

// Create a Go file at the root
if err := os.WriteFile(filepath.Join(dir, "main.go"), []byte("package main\n"), 0o600); err != nil {
t.Fatal(err)
}

// Create a .worktrees directory with a Go file inside
wtDir := filepath.Join(dir, ".worktrees", "feature-branch", "src")
if err := os.MkdirAll(wtDir, 0o755); err != nil {
t.Fatal(err)
}
if err := os.WriteFile(filepath.Join(wtDir, "app.go"), []byte("package app\n"), 0o600); err != nil {
t.Fatal(err)
}

ctx := context.Background()
files, err := Discover(ctx, dir, nil)
if err != nil {
t.Fatalf("Discover: %v", err)
}

if len(files) != 1 {
t.Fatalf("expected 1 file (skipping .worktrees), got %d", len(files))
}
if filepath.Base(files[0].Path) != "main.go" {
t.Errorf("expected main.go, got %s", files[0].Path)
}
}

func TestDiscoverCancellation(t *testing.T) {
dir := t.TempDir()

Expand Down