Skip to content

ignore: improve git_ignore_path_is_ignored description Git analogy#4722

Merged
ethomson merged 1 commit into
libgit2:masterfrom
boogisha:path-is-ignored-git-analogy
Jul 16, 2018
Merged

ignore: improve git_ignore_path_is_ignored description Git analogy#4722
ethomson merged 1 commit into
libgit2:masterfrom
boogisha:path-is-ignored-git-analogy

Conversation

@boogisha

Copy link
Copy Markdown
Contributor

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 #4720 (git_ignore_path_is_ignored documentation
misleading?, 2018-07-10) for additional information.

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
@ethomson

Copy link
Copy Markdown
Member

Thanks!

@ethomson ethomson merged commit 99bb98c into libgit2:master Jul 16, 2018
@boogisha

Copy link
Copy Markdown
Contributor Author

You're welcome, thanks for merging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants