From: John Thorvald Wodder II Date: Tue, 28 Jun 2022 13:57:51 GMT Subject: Re: Oddities in gitignore matching Message-ID: <288621B7-8418-471B-8C64-3F8AE5AA4DC2@gmail.com> In-Reply-To: <0871A57F-4AF4-4F45-AC56-10C1817761BB@gmail.com> On 2022 Jun 28, at 09:48, John Thorvald Wodder II wrote: > Through further experimentation, I've discovered a fourth oddity with gitignore: If "foo//" (with two or more trailing slashes) is added to .gitignore and `mkdir -p foo/bar` is run, then `git status --ignored=matching --porcelain` won't show "foo/" or "foo/bar/" at all, which is something I'd previously only encountered for completely empty top-level directories. This holds true no matter how deep or wide you make the directory tree at "foo/", as long as it's all-directories; once a file gets added somewhere under "foo/", the "git status" command shows "foo/" as ignored. Correction: When a file is added under "foo/", then "git status" shows it as *untracked*, not ignored. I also see now that a pure-directory tree being absent from "git status" happens even without a .gitignore, so presumably this is intended behavior. It's just a little odd that, if "foo/" is an empty top-level directory, it only shows up in "git status --ignored=matching" if it's ignored. -- John Wodder