package indexer import ( "os" "path/filepath" "strings" "testing" "github.com/stretchr/testify/require" "go.uber.org/zap" "github.com/zzet/gortex/internal/config" "github.com/zzet/gortex/internal/excludes" "github.com/zzet/gortex/internal/graph" "github.com/zzet/gortex/internal/parser" "github.com/zzet/gortex/internal/parser/languages" ) // TestIndex_GitignoreDirNegation is the regression test for issue #113: // a WordPress repo blanket-ignores wp-content/plugins/* and re-includes // its custom plugins with "!wp-content/plugins//". go-gitignore's // "*" matches across "/", so the parent directory wp-content/plugins is // itself reported as excluded; the walk used to prune it with SkipDir // before ever reaching the re-included children, indexing only the // repo-root files. The walk must instead descend the parent and let the // per-file check honour the negation. func TestIndex_GitignoreDirNegation(t *testing.T) { dir := t.TempDir() mustWrite := func(rel, content string) { p := filepath.Join(dir, rel) require.NoError(t, os.MkdirAll(filepath.Dir(p), 0o755)) writeFile(t, p, content) } php := func(fn string) string { return "