gemini-cli PR fixes nested .gitignore trailing-slash patterns wrongly anchored

dylanyunlon · ghdev · 2026-09-14

A PR against google-gemini/gemini-cli fixes a bug where trailing-slash patterns (e.g. build/) in a nested .gitignore were incorrectly anchored to the .gitignore's own directory instead of matching at any depth, so pkg/tools/build/out.js wasn't ignored as git would.

The root cause: processPatterns() used !p.includes('/') to decide on a / prefix, and the trailing slash itself contains /. Per gitignore(5), a trailing slash only restricts matching to directories. The fix adds hasContentSlash(), which strips the trailing slash before checking for remaining slashes, rewriting build/ as /pkg//build/. The PR adds 16 unit and regression tests covering trailing/middle slashes, wildcards, and negation.

Original post →

More from coding & agent

coding & agent channel →