Title: git_ignore_path_is_ignored documentation misleading? · Issue #4720 · libgit2/libgit2 · GitHub
Open Graph Title: git_ignore_path_is_ignored documentation misleading? · Issue #4720 · libgit2/libgit2
X Title: git_ignore_path_is_ignored documentation misleading? · Issue #4720 · libgit2/libgit2
Description: Due to an issue experienced elsewhere (git-tfs/git-tfs#1208), I've stumbled across git_ignore_path_is_ignored() function from "libgit2", where it returned TRUE for a path already committed to the repository. I instantly thought this was ...
Open Graph Description: Due to an issue experienced elsewhere (git-tfs/git-tfs#1208), I've stumbled across git_ignore_path_is_ignored() function from "libgit2", where it returned TRUE for a path already committed to the r...
X Description: Due to an issue experienced elsewhere (git-tfs/git-tfs#1208), I've stumbled across git_ignore_path_is_ignored() function from "libgit2", where it returned TRUE for a path already comm...
Opengraph URL: https://github.com/libgit2/libgit2/issues/4720
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"git_ignore_path_is_ignored documentation misleading?","articleBody":"Due to an issue experienced elsewhere (https://github.com/git-tfs/git-tfs/issues/1208), I've stumbled across `git_ignore_path_is_ignored()` function from \"libgit2\", where it returned TRUE for a path already committed to the repository.\r\n\r\nI instantly thought this was a bug, as something already tracked shouldn't be subject to \".gitignore\" exclude rules (think [`git check-ignore`][1]), but eventually reading `git_ignore_path_is_ignored()` description, this seems to be by design...?\r\n\r\nhttps://github.com/libgit2/libgit2/blob/89c332e41b12a72d89de40d63bc568c56a2c336a/include/git2/ignore.h#L56-L60\r\n\r\nI guess there is a good reason for this (like making ignore rules parsing standalone, where one can check for index existence elsewhere... or something), but additional comment that follows seems misleading:\r\n\r\nhttps://github.com/libgit2/libgit2/blob/89c332e41b12a72d89de40d63bc568c56a2c336a/include/git2/ignore.h#L62-L63\r\n\r\nThis is not correct in the above mentioned case of an already tracked file, as even if it matches a pattern inside \".gitignore\", `git add .` will add modifications of that file to index, where `git_ignore_path_is_ignored()` will still return TRUE as if the file is to be ignored (which is not true).\r\n\r\nOf course, in case file is untracked, `git add .` will ignore it as expected (not adding it to index), and `git_ignore_path_is_ignored()` returning TRUE would make sense... just that it doesn't align with `git add .` in general, but in some case(s) only.\r\n\r\nShould this `git add .` comparison be dropped (or somehow reworded) to avoid confusion, or am I missing something?\r\n\r\nThanks, Buga\r\n\r\n[1]: https://git-scm.com/docs/git-check-ignore","author":{"url":"https://github.com/boogisha","@type":"Person","name":"boogisha"},"datePublished":"2018-07-10T21:17:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/4720/libgit2/issues/4720"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d87c75a9-b768-cab5-9fe3-5b437fe95bbf |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C3C8:3CD7D9:8EBE26C:C249164:6A5EA546 |
| html-safe-nonce | 11446edf4ef7c6bb863a1512b4ebd013d78bf2b195c69969a60170634b51184d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDM0M4OjNDRDdEOTo4RUJFMjZDOkMyNDkxNjQ6NkE1RUE1NDYiLCJ2aXNpdG9yX2lkIjoiNzI3MzkwNzk1MjMxMDcyMzkxMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 101824f7b9c56dde069b4f083b952e512976b7b2c8b4db8f597ab05bfd0a00d1 |
| hovercard-subject-tag | issue:340010333 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/libgit2/libgit2/4720/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9b5f89afaf6ee04986e5669bfc116cd248fd73826a4e9ef26adb2a5b6a78f7c0/libgit2/libgit2/issues/4720 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9b5f89afaf6ee04986e5669bfc116cd248fd73826a4e9ef26adb2a5b6a78f7c0/libgit2/libgit2/issues/4720 |
| og:image:alt | Due to an issue experienced elsewhere (git-tfs/git-tfs#1208), I've stumbled across git_ignore_path_is_ignored() function from "libgit2", where it returned TRUE for a path already committed to the r... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | boogisha |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7c7e31acb6a895494e518b880f5ccf39604f7fa9a8f2f3c64145efc3b776256d |
| turbo-cache-control | no-preview |
| go-import | github.com/libgit2/libgit2 git https://github.com/libgit2/libgit2.git |
| octolytics-dimension-user_id | 394745 |
| octolytics-dimension-user_login | libgit2 |
| octolytics-dimension-repository_id | 901662 |
| octolytics-dimension-repository_nwo | libgit2/libgit2 |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 901662 |
| octolytics-dimension-repository_network_root_nwo | libgit2/libgit2 |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2d2ac9bdd71d5f53f2b731c9330677e38624e301 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width