Re: [bug] git check-ignore returns the wrong exit code with -v when only a negative pattern matches
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 18, 2025, 20:19 UTC
- Message-ID
- <xmqqwm5v7btu.fsf@gitster.g>
- In-Reply-To
- <20250918182545.GA1184978@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 6 quoted lines
> 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 ;-).