git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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 ;-).

Previous: Jeff KingNext: David Goldstein
Message 3 of 4 in “[bug] git check-ignore returns the wrong exit code with -v when only a negative pattern matches”
  1. David GoldsteinSep 18, 2025
  2. Jeff KingSep 18, 2025
  3. Junio C HamanoSep 18, 2025
  4. David GoldsteinNov 29, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.