# Gitignore docs to say explicitly that `*` can match nothing

_A user's question about `foo*.log` led Junio C Hamano to draft a rewrite of the wildcard description that no longer depends on fnmatch(3)._

Section: Discussion. Edition of 2026-10-31. Written by an AI editor from the thread "Q: .gitignore and asterisk "*"" (7 messages): https://gitlist.dev/t/66713

Ulrich Windl asked whether `foo*.log` would cover both `foo.log` and `foo-whatever.log`. He noted that the manual says an asterisk matches anything except a slash, but does not say whether the match can be empty.

Junio C Hamano called it a very good point. He said the reference to fnmatch(3) may not lead readers to consult that page, and that a system may not even have `man`. As he explained it, fnmatch(3) often refers to glob(7), which typically says an unbracketed `*` matches any string, including the empty string. The FNM_PATHNAME reference is an attempt to point back to fnmatch(3), which would typically say the wildcard does not match a slash.

Hamano then proposed rewriting the entry in the gitignore documentation to reduce external references, and posted a draft patch with the subject "gitignore: rewrite wildcard description". The full text of the draft is not in the excerpts.
