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

Re: [PATCH] Allow git-diff exit with codes similar to diff(1)

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Mar 14, 2007, 01:13 UTC
Message-ID
<Pine.LNX.4.64.0703131757080.9690@woody.linux-foundation.org>
In-Reply-To
<81b0412b0703131717k7106ee1cg964628f0bda2c83e@mail.gmail.com>
On Wed, 14 Mar 2007, Alex Riesen wrote:
>
> This introduces a new command-line option: --exit-code. The diff
> programs will return 1 for differences, return 0 for equality, and
> something else for errors.
I don't think you should need a new command-line option.
Is there any reason to not just do this unconditionally?
> As promised on irc. I'm somewhat confused about diff_tree: it used to
> unconditionally return 0, yet every caller of it saves and passes the
> value!

I think we just never implemented the error codes, but they were always meant to be there.

I also thought I did some early-out logic (for the revision list pruning thing), where the "show_entry()" routine could return a negative value to say "Ok, no need to do anything more" but apparently I never added that..

[ I have this very distinct memory of working on it, but either I was 
  dreaming or I never got it working.. ]
			Linus
Previous: Junio C HamanoNext: Johannes Schindelin
Message 5 of 32 in “Allow git-diff exit with codes similar to diff(1)”
  1. Allow git-diff exit with codes similar to diff(1)Alex Riesen, Mar 14, 2007
  2. Johannes SchindelinMar 14, 2007
  3. Linus TorvaldsMar 14, 2007
  4. Junio C HamanoMar 14, 2007
  5. Linus TorvaldsMar 14, 2007
  6. Johannes SchindelinMar 14, 2007
  7. Linus TorvaldsMar 14, 2007
  8. Johannes SchindelinMar 14, 2007
  9. Alex RiesenMar 14, 2007
  10. Johannes SchindelinMar 14, 2007
  11. Alex RiesenMar 14, 2007
  12. Johannes SchindelinMar 14, 2007
  13. Simon 'corecode' SchubertMar 15, 2007
  14. Alex RiesenMar 15, 2007
  15. Junio C HamanoMar 14, 2007
  16. Alex RiesenMar 14, 2007
  17. Junio C HamanoMar 14, 2007
  18. Junio C HamanoMar 14, 2007
  19. Alex RiesenMar 14, 2007
  20. Junio C HamanoMar 14, 2007
  21. Alex RiesenMar 14, 2007
  22. Junio C HamanoMar 14, 2007
  23. Alex RiesenMar 14, 2007
  24. Junio C HamanoMar 14, 2007
  25. Allow git-diff exit with codes similar to diff(1)Alex Riesen, Mar 14, 2007
  26. Junio C HamanoMar 14, 2007
  27. Alex RiesenMar 14, 2007
  28. Junio C HamanoMar 14, 2007
  29. Allow git-diff exit with codes similar to diff(1)Alex Riesen, Mar 14, 2007
  30. Junio C HamanoMar 14, 2007
  31. Junio C HamanoMar 14, 2007
  32. Alex RiesenMar 14, 2007

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.