Gemini CLI GitIgnoreParser bug hides files re-included by nested .gitignore

auraseb · ghdev · 2026-10-19

Issue #29826 in google-gemini/gemini-cli: with a root .gitignore containing logs/ and a nested logs/.gitignore containing !keep.txt, Gemini CLI treats git-tracked logs/keep.txt as ignored, hiding it from @ completion, glob, grep, readmanyfiles, and the folder tree.

Per git semantics, logs/ matches contents but not the directory itself, so git still reads logs/.gitignore and the negation re-includes the file (verified via git check-ignore -v). The regression comes from #29582 (subtree pruning): expandWildcardDirectoryPatterns rewrites logs/ to also add /logs/, marking the directory itself ignored so GitIgnoreParser.computeRelDirState never loads the nested .gitignore. The expansion guard only considers negations in the same file, not in the directory's own .gitignore. The reporter has located the root cause and prepared a fix with a regression test, offering to open a PR.

Original post →

More from coding & agent

coding & agent channel →