ignore: don't leak rules into higher directores

When we mention "src" in src/.gitignore, we wrongly consider src/ itself
to be ignored.

This is a test for the behaviour described in #2595 so we have test we can make pass.