Repository navigation
Description
Summary
Since ignore files below the scan root are read live during the walk (#1206) and .gitignore is merged into the ignore logic (#1363), graphify extract now honors every .gitignore it encounters anywhere under the scan root. That is usually correct — but there is no way to turn it off, and it silently removes source files that are deliberately git-ignored yet are exactly what we want in the graph.
Concretely: a large body of transpiled/generated C# code lives in generated/ directories that the project's .gitignore excludes (generated output is conventionally not committed). That code is the behavior we analyze. On a version that only read the scan root's own ignore files this code was extracted; after upgrading, all of it disappears — no error, no warning, the files simply don't appear in the graph, so the loss is easy to miss.
Environment
graphifyy: a version that did not read nested.gitignorevs. current that does (0.9.13 → 0.9.18 in our case)- Windows 11, Python 3.14, C# corpus (nodes are
_origin: ast)
Minimal reproduction (verified on 0.9.18)
mkdir -p root/proj/deep/generated
printf 'namespace N { public class Real { public void M(){} } }\n' > root/proj/Real.cs
printf 'namespace N { public class Keep { public void M(){} } }\n' > root/proj/deep/Keep.cs
printf 'namespace N { public class Gen { public void M(){} } }\n' > root/proj/deep/generated/Gen.cs
printf 'generated/\n' > root/proj/.gitignore # nested, BELOW the scan root
graphify extract root --out out # exits 0, no warningInspect source_file on the nodes in out/graphify-out/graph.json.
Observed (actual): only proj/Real.cs and proj/deep/Keep.cs are present.
proj/deep/generated/Gen.cs is absent — silently pruned because proj/.gitignore excludes generated/.
Desired: a supported way to include Gen.cs despite the .gitignore exclusion (see request below).
On a real transpiled graph the aggregate impact is large: distinct .cs files 1200 → 936 (−264, all under generated/); AST nodes −13%; edges −29%.
What we ruled out while diagnosing
- Not the parser: identical
tree-sitter(0.25.2) /tree-sitter-c-sharp(0.23.5); the dropped files parse fine in isolation (extract_csharp(path)returns 45 nodes, no error). - Not dedup, not a file-size cap, not
_SKIP_DIRS(there is nogeneratedliteral in the skip set). - Confirmed mechanism:
detect._load_dir_own_ignore(proj)readsproj/.gitignoreduring the walk and returns thegenerated/pattern, which prunes the directory. This function/behavior is only present in the newer version.
Only workaround we could find (verified on 0.9.18)
Place a .graphifyignore containing both !generated/ and !generated/** in the same directory as the offending .gitignore (root/proj/.graphifyignore). Re-running the repro then includes proj/deep/generated/Gen.cs.
- This works because per-directory
.graphifyignoreis read after.gitignore(_load_dir_own_ignore), so the!negation wins via last-match-wins and the directory is not pruned. - A re-include placed at the scan root does not work: the nested
.gitignoreis loaded later during the walk and wins. So the escape hatch must be co-located with each offending.gitignore, which is non-obvious and awkward to automate.
Questions / requests
- Is there an existing flag or config to disable honoring
.gitignore(and$GIT_DIR/info/exclude) during extraction? We could not find one. - If not, would you consider a
--no-gitignore/--ignore-vcs-ignoresopt-out? Honoring.gitignoreis a sensible default, but generated/transpiled code that is git-ignored yet analysis-relevant is a real case (build output, codegen, transpiler targets), and there is currently no clean escape hatch. - If the intended answer is "use a co-located
.graphifyignorere-include", could the precedence (a nested.gitignorebeats a scan-root.graphifyignore; only a co-located!wins) be documented? It is currently surprising.
Either way, this project is great, and I'd like to thank everyone who's actively contributing to it. Have a great weekend. <3
Activity
Mzt00 commentedon Jul 17, 2026
There is currently no flag or configuration to disable
.gitignoreor$GIT_DIR/info/exclude.A co-located
.graphifyignorere-include works because it is evaluated after that directory’s.gitignore. A scan root re-include cannot override a nested.gitignore, since the nested rules are loaded later.I'd be happy to work on the issue!
fix(extract): persist --no-gitignore instead of clobbering it (follow…
docs: changelog entries for the #1989/#1971/#1975/#1978/#1980 fixes
safishamsi commentedon Jul 18, 2026
Fixed on v8 (ships in 0.9.19) via #1979 (f17e2c5) + persistence follow-up (caa6f9e), thanks @mzt006. --no-gitignore indexes git-ignored code (keeping .graphifyignore and the secret screens), and the setting persists across flag-less re-extracts.
docs: correct #1971 credit (@Mzt00 fix, @JensD-git report; not @mzt006)
safishamsi commentedon Jul 18, 2026
Apologies @MZT006 — wrong ping, that was my mistake. The fix (#1979) was authored by @Mzt00 and the report by @JensD-git; I mistyped the handle. Corrected in the changelog and the 0.9.19 release notes. Sorry for the noise.
fix(extract): persist --no-gitignore instead of clobbering it (follow…
docs: changelog entries for the Graphify-Labs#1989/Graphify-Labs#1971/G…
docs: correct Graphify-Labs#1971 credit (@Mzt00 fix, @JensD-git repor…
feat(extract): record the --code-only scope in .graphify_build.json (#…