ignore: improve git_ignore_path_is_ignored
description Git analogy
#4722
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In attempt to provide adequate Git command analogy in regards to
ignored files handling,
git_ignore_path_is_ignored
descriptionmentions doing
git add .
on directory containing the file, andwhether the file in question would be added or not - but behavior of
the two matches for untracked files only, making the comparison
misleading in general sense.
For tracked files, Git doesn't subject them to ignore rules, so even
if a rule applies,
git add .
would actually add the tracked filechanges to index, while
git_ignore_path_is_ignored
would stillconsider the file being ignored (as it doesn't check the index, as
documented).
Let's provide
git check-ignore --no-index
as analogous Git commandexample instead, being more aligned with what
git_ignore_path_is_ignored
is about, no matter if the file in question is already tracked or not.
See issue #4720 (git_ignore_path_is_ignored documentation
misleading?, 2018-07-10) for additional information.