Re: .gitignore Bug Report on the behavior of *
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Sep 25, 2010, 20:53 UTC
- Message-ID
- <AANLkTinF2Bk0O96hPiB+WFzWAwEqu=wqdXEnM39+JOoN@mail.gmail.com>
- In-Reply-To
- <201009252203.48820.j6t@kdbg.org>
On Sat, Sep 25, 2010 at 20:03, Johannes Sixt <j6t@kdbg.org> wrote:
Show 19 quoted lines
> On Samstag, 25. September 2010, Seth Robertson wrote: >> # Properly shows X and B/XX as untracked, as I expected >> echo X > X; echo XX > B/XX; git status >> >> # I expected B/XX to show up as untracked >> rm -f .gitignore B/.gitignore >> echo '*' > .gitignore; echo '!*' > B/.gitignore; git status > > You should update your expectations to match what you got. ;-) > > To show why your expectations are wrong, consider a *huge* and *deep* > directory with thousands and thousands of subdirectories, call it "usr", that > should be ignored. The .gitignore at the top-level would just say: > > /usr > > Do you really expect git to walk down this ignored directory, just to make > double-sure that really, really down there does nowhere exist a .gitignore > that says "oh, wait, don't ignore *this* file"?
That wouldn't be so expensive if the expectation that the .gitignore in /usr would only be considered if it had already been commited. Then we'd just have to check if we have a tree for /usr, and whether there's a gitignore there.
But doing this in the top-level .gitignore if possible is the best solution.