ignore: improve git_ignore_path_is_ignored description Git analogy#4722
Merged
Conversation
In attempt to provide adequate Git command analogy in regards to ignored files handling, `git_ignore_path_is_ignored` description mentions doing `git add .` on directory containing the file, and whether 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 file changes to index, while `git_ignore_path_is_ignored` would still consider the file being ignored (as it doesn't check the index, as documented). Let's provide `git check-ignore --no-index` as analogous Git command example 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 libgit2#4720 (git_ignore_path_is_ignored documentation misleading?, 2018-07-10)[1] for additional information. [1] libgit2#4720
Member
|
Thanks! |
Contributor
Author
|
You're welcome, thanks for merging! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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_ignoreddescriptionmentions 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_ignoredwould stillconsider the file being ignored (as it doesn't check the index, as
documented).
Let's provide
git check-ignore --no-indexas analogous Git commandexample instead, being more aligned with what
git_ignore_path_is_ignoredis 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.