perf(#3384): skip fnamemodify in is_git when GIT_DIR unset #3388
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.35) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.35 · 175 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.309
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3388"
general
weight: 0.35
hood
In
explorer/watch.lua,is_gitexecutes for every directory node assigned a filesystem watcher.Previously, even when
GIT_DIRwas unset, the function invoked expensive Vimscript evaluations, callingvim.fn.fnamemodify(path, ":p"),fnamemodify(nil, ":p"), andfnamemodify(path, ":t")on every check 🫠 .This change basically guards the
GIT_DIRresolution behind an environment check and replacesfnamemodify(..., ":t")with path extraction in purelua, eliminating the Vimscript round-trips during directory scanning.I thought we could even cache
GIT_DIR, but that would expose us to the risk of not catching up if the env var gets changed at runtime, uncommon but better safe than sorry 🤷 .Note I used
utils.path_basename(path)as the lua equivalent offnamemodify(path, ":t”), as I already noticed this was its use in the pre-existing codebase.Measured impact:
is_gitacross ~1,5k directories dropped from ~130 ms down to ~2.5 ms (~50x speedup) (!!)AI usage: Claude Code (Opus 5.5) helped on self-review, code cleanup and most importantly measuring the impact.
Tested on macOS nvim-dev 0.13, untested on Windows (though
path_basenamerelies onpackage.configpath separators), Linux, Neovim 0.10/0.11, and scenarios whereGIT_DIRis explicitly defined.resolves #3384