Thread (2 messages) flat view 2 messages, 2 authors, 2025-09-18

[bug] git check-ignore returns the wrong exit code with -v when only a negative pattern matches

From: David Goldstein <hidden>
Date: 2025-09-18 17:28:22

Hey folks, I think I found a git check-ignore bug.  According to the
docs, git check-ignore should only exit 0 if a file is ignored, but if
an untracked file matches a negative pattern in .gitignore (or the
file can be tracked if --no-index is also used), then git check-ignore
-v <file> exits 0 when it should exit 1; without -v the exit code is
correct (0).

https://github.com/dgoldstein0/git_bug_repro has a self-contained
reproduction + repeated explanation.

This exists in all git versions I've tested, but I haven't tried to
get the latest dev version to check if it's still a problem in the
latest version.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help