Re: git 2.34.0: Behavior of `**` in gitignore is different from previous versions.
From: Johannes Sixt <hidden>
Date: 2021-11-19 20:05:45
Am 19.11.21 um 15:51 schrieb Derrick Stolee:
What is unclear to me is what exactly "match a directory" means. If we ignore a directory, then we ignore everything inside it (until another pattern says we should care about it), but the converse should also hold: if we have a pattern like "!data/**/", then that should mean "include everything inside data/<A>/ where <A> is any directory name". My inability to form a mental model where the existing behavior matches the documented specification is an indicator that this was changed erroneously. A revert patch is included at the end of this message. If anyone could help clarify my understanding here, then maybe there is room for improving the documentation.
You form a wrong mental model when you start with the grand picture of a working tree. That is, when you say - here I have theeeeeese many files and directories, - and I want to ignore some: foo/**/, - but I don't want to ignore others: !bar/**/. This forms the wrong mental model because that is not how Git sees the working tree: it never has a grand picture of all of its contents. Git only ever sees the contents of one directory. When Git determines that a sub-directory is ignored, then that one's contents are never inspected, and there is no opportunity to un-ignore some of the sub-directory's contents. -- Hannes