Re: [PATCH v3 6/8] dir: avoid unnecessary traversal into ignored directory
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 10, 2021, 05:48 UTC
- Message-ID
- <xmqq35uvrvfv.fsf@gitster.g>
- In-Reply-To
- <66ffc7f02d08f3f07cb3cb2605b113a630f1e127.1620503945.git.gitgitgadget@gmail.com>
"Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com> writes:
> Some sidenotes about possible confusion with dir.c:
Thanks for working on untangling this mess ;-)
Show 5 quoted lines
> * "ignored" often refers to an untracked ignore", i.e. a file which is > not tracked which matches one of the ignore/exclusion rules. But you > can also have a "tracked ignore", a tracked file that happens to match > one of the ignore/exclusion rules and which dir.c has to worry about > since "git ls-files -c -i" is supposed to list them.
OK. This is to find a pattern in .gitignore that is too broad (i.e. if the path were to be added as a new thing today, it would require "add -f"), right? The combination of "-i -c" does make sense for that purpose.
> * The dir code often uses "ignored" and "excluded" interchangeably, > which you need to keep in mind while reading the code.
True. In tree .gitignore files are to hold exclude patterns, and per repository personal exclude file is called $GIT_DIR/info/exclude which is confusing.
Show 10 quoted lines
> Sadly, though, > it can get very confusing since ignore rules can have exclusions, as > in the last of the following .gitignore rules: > .gitignore > *~ > *.log > !settings.log > In the last entry above, (pathspec->items[3].magic & PATHSPEC_EXCLUDE) > will be true due the the '!' negating the rule. Someone might refer > to this as "excluded".
That one I've never heard of. As far as I am concerned, that is a negative exclude pattern.
I do wish we started the project with .gitignore files and $GIT_DIR/info/ignore both of which holds ignore patterns and negative ignore patterns from day one, but the boat sailed long time ago.