You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Negation re-includes files under a directory excluded by a directory rule #7283
Then query whether d/sub/f.txt is ignored, e.g. git_ignore_path_is_ignored(), or git_status/git_diff_tree_to_workdir with GIT_DIFF_INCLUDE_UNTRACKED.
Expected behavior
d/sub/f.txt is ignored, matching core git: git check-ignore d/sub/f.txt reports it's
excluded by the d/ rule. The !d/sub/* negation has no effect because a parent directory is
excluded — per the gitignore docs: "It is not possible to re-include a file if a parent
directory of that file is excluded."
Actual behavior
libgit2 reports d/sub/f.txt as not ignored (git_ignore_path_is_ignored returns 0, and
it shows up as untracked under GIT_DIFF_INCLUDE_UNTRACKED).
Same result with d/** instead of d/, and with !d/sub/** instead of !d/sub/*.
It works correctly when the negation targets a direct child of the excluded dir
(d/sub/ + !d/sub/f.txt → ignored, agreeing with git); the divergence only appears when the
re-included path sits under an intermediate subdirectory of the excluded directory.
Activity