Skip to content

graphify now respects git's global ignore file - #4339

Closed
smngvlkz wants to merge 2 commits into
Graphify-Labs:v8from
smngvlkz:fix/global-gitignore
Closed

smngvlkz wants to merge 2 commits into
Graphify-Labs:v8from
smngvlkz:fix/global-gitignore

Conversation

@smngvlkz

Copy link
Copy Markdown
Contributor

Fixes #4335.

What this fixes

You can tell git to ignore files in each project with a .gitignore, or once for your whole computer with git's global ignore file. graphify was respecting the first one but not the second, so a file you hid using the computer-wide list could still end up in your graph.

That global list is usually where people put local settings and other private files, so it's the one that matters most here.

What changed

graphify now reads git's global ignore file too, the same way git does:

  • if you've set one with git config core.excludesFile, it uses that
  • if not, it uses git's default spot, ~/.config/git/ignore
  • your project's own .gitignore still wins, so a ! rule there can bring a file back in, same as git
  • --no-gitignore turns it off along with the other git ignore rules
  • it only kicks in inside a git repo, like git

How I tested it

  • Ran the example from the issue. Before this change secret.py showed up in the graph, now it doesn't.
  • Added tests for a custom core.excludesFile, the default ~/.config/git/ignore, XDG_CONFIG_HOME, a project ! rule beating the global one, --no-gitignore, and a folder that isn't a git repo. They fail on the current v8 and pass with this change.
  • Full test suite passes.

Heads up

This means what graphify picks up can now depend on your global git settings, not just files in the project. That's the point of the fix, and it's the same thing git does, but it's worth knowing if two people get slightly different file lists.

@smngvlkz
smngvlkz requested a review from safishamsi as a code owner October 11, 2026 14:51
@github-actions

Copy link
Copy Markdown

Thanks for the pull request, @smngvlkz. A maintainer will review it soon.

Want to talk it through while it is in review? Come join us on our Discord server. For longer-form discussion there is also GitHub Discussions.

A couple of things that speed up review: make sure the test suite passes on Python 3.10 and 3.13, and that the change keeps extraction deterministic.

@github-actions github-actions Bot added contributor Pull request from a returning community contributor needs:title PR title should follow the conventional-commit format labels Oct 11, 2026
@github-actions

Copy link
Copy Markdown

Thanks @smngvlkz! One small thing: our changelog and release notes are built from PR titles, so we use the conventional-commits format, for example:

fix(python): resolve a bare stdlib import correctly

Prefixes we use: feat, fix, docs, chore, refactor, test, perf, build, ci. Editing the PR title clears this automatically. This is just a nudge and does not block review.

@graphify-labs graphify-labs Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Graphify reviewed this change.

Worth a look — the grounded gate found no coupling regressions or blocking issues, but 1 advisory finding(s) below merit a look before merge.

Not checked: tests were not run; formal verification proved 0 of 1 changed function(s) (1 sampled, not proven).

Formal verification. PR-changed functions: 1/1 verified (0 proven, 1 may-equivalent, 0 distinguished) · 0 not verified.


Graphify review — findings

Makes detect honour git's user-wide excludes file, so files a user ignores machine-wide (local settings, secrets) stay out of the graph (#4335). _git_global_excludes reads core.excludesFile via git config --path and falls back to $XDG_CONFIG_HOME/git/ignore or ~/.config/git/ignore when the key is unset or git is unavailable; like git, it only applies inside a repo. Its patterns load first, anchored at the VCS root, so info/exclude and per-directory ! rules override them, and gitignore=False turns them off with the other git sources.

Worth a look

  • Detect can now crash when the home directory is not resolvable — graphify/detect.py:1364 · Escalate · medium
    • agreed by 2 of 2 members but NOT verified (no proof, no reproducing execution) — consensus is not a verdict; needs human review
Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 3246 functions depend on the 626 functions this change touches.

Health — this change adds coupling hotspots:

  • worse: detect() — 130 callers, 16 callees
  • worse: _load_graphifyignore() — 23 callers, 6 callees

Verification — 3246 functions in the blast radius were not formally verified this run (proofs are advisory here).

Gate & verification

graphify gate

PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.

Advisory (not blocking):

  • verification_scope: 1183 function(s) in the blast radius were not formally verified this run

Test selection

Test selection

69 of 367 test file(s) selected (19%) via static blast radius.

  • tests/test_astro_extraction.py — impact
  • tests/test_atomic_writes.py — impact
  • tests/test_build.py — impact
  • tests/test_cargo_introspect.py — impact
  • tests/test_charmap_encoding.py — impact
  • tests/test_chunking.py — impact
  • tests/test_cjs_module_extension.py — impact
  • tests/test_claude_cli_backend.py — impact
  • tests/test_cpp_nested_and_cli.py — impact
  • tests/test_detect.py — impact, changed-test
  • tests/test_docx_to_markdown.py — impact
  • tests/test_dotnet.py — impact
  • tests/test_evidence_binding.py — impact
  • tests/test_extract.py — impact
  • tests/test_extract_cli.py — impact
  • tests/test_extract_php_closures.py — impact
  • tests/test_file_slice.py — impact
  • tests/test_file_truncation_warning.py — impact
  • tests/test_ignore_file_encoding.py — impact
  • tests/test_image_vision.py — impact
  • tests/test_import_extension_resolution.py — impact
  • tests/test_incremental_mtime_collision.py — impact
  • tests/test_indirect_call_block_scoped_shadow.py — impact
  • tests/test_indirect_dispatch.py — impact
  • tests/test_indirect_dispatch_assign_return.py — impact
  • tests/test_indirect_dispatch_getattr.py — impact
  • tests/test_js_exported_scalar_bindings.py — impact
  • tests/test_languages.py — impact
  • tests/test_llm_backends.py — impact
  • tests/test_long_path_hashing.py — impact
  • tests/test_manifest_ingest.py — impact
  • tests/test_markdown_code_spans.py — impact
  • tests/test_mcp_ingest.py — impact
  • tests/test_multilang.py — impact
  • tests/test_non_regular_files.py — impact
  • tests/test_office_incremental.py — impact
  • tests/test_office_limits.py — impact
  • tests/test_ollama.py — impact
  • tests/test_out_dir_evidence.py — impact
  • tests/test_oversized_document_slicing.py — impact
  • tests/test_package_json_subpath_imports.py — impact
  • tests/test_pdf_extra_warning.py — impact
  • tests/test_pdf_slicing.py — impact
  • tests/test_pdf_token_estimate.py — impact
  • tests/test_phantom_external_import.py — impact
  • tests/test_php_unparsed_casts.py — impact
  • tests/test_pipeline.py — impact
  • tests/test_python_inherited_method_calls.py — impact
  • tests/test_python_underscore_resolution.py — impact
  • tests/test_rationale.py — impact
  • … and 19 more

Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.

Formal verification

No difference found (not proven): No behavior difference found in \_load\_graphifyignore (not a proof).

The verifier ran both versions of \_load\_graphifyignore on many inputs and saw identical behavior every time. Strong evidence the change is safe, but evidence, not a proof.

Guarantee: Empirical: differential testing (both versions run on many generated inputs). A divergence on an untested input remains possible, so this is 'no counterexample found', not 'proven equivalent'.

Note: An input the sampler did not try could still differ.

· 2 more finding(s) on lines outside this diff (see the check run).

safishamsi pushed a commit that referenced this pull request Oct 11, 2026
@safishamsi

Copy link
Copy Markdown
Member

Landed in 0.9.86 (now on PyPI) via an authorship-preserving cherry-pick, so your commit authorship is retained. Thank you, @smngvlkz!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor Pull request from a returning community contributor needs:title PR title should follow the conventional-commit format

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: graphify reads files that git's global ignore file hides

2 participants