Perhaps I'm doing something wrong, but according to the .gitignore doc:
The pattern foo/*, matches foo/test.json (a regular file), foo/bar (a directory), but it does not match foo/bar/hello.c (a regular file), as the asterisk in the pattern does not match bar/hello.c which has a slash in it.
However, if I try the following:
In [16]: spec = pathspec.GitIgnoreSpec.from_lines(["foo/*"])
In [17]: spec.match_file("foo/bar/hello.c")
Out[17]: True
Am I not using the right spec, or is there something that I am not grasping?