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

From: Junio C Hamano <[email-masked]>
Date: Thu, 18 Sep 2025 13:19:41 -0700

Jeff King <[email-masked]> writes:

> AFAICT it has been this way since the inception of the code. I haven't
> ever used the exit code of check-ignore. I wonder if the current
> behavior is actually useful, along the lines of "exit 0 if any output
> was shown, and 1 otherwise". That would justify a difference in behavior
> between running with "-v" and without. But again, I've never used the
> exit code so I'm not sure in what circumstances it would be useful.

I very much agree with your assessment, as my understanding is that
the command is primarily for debugging your .gitignore pattern by
eyeballing the output from it (as opposed to a serious tool to see
if a particular path is or is not ignored), so I am not surprised if
its exit code handling is buggy, and I am not suprirsed at all if
nobody has even noticed it is buggy ;-).